码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
[LeetCode] Binary Tree Level Order Traversal
Binary Tree Level Order Traversal   Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree {3,9,...
分类:其他好文   时间:2015-05-16 20:35:48    阅读次数:155
【Validate Binary Search Tree】cpp
题目:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains onl...
分类:其他好文   时间:2015-05-16 20:21:48    阅读次数:91
【Tree】二叉树先序遍历 迭代 & 递归
1 /*************************** 2 https://leetcode.com/problems/binary-tree-preorder-traversal/ 3 @date 2015.5.13 4 @description 5 用非递归方法对二叉树进行先序...
分类:其他好文   时间:2015-05-16 18:19:07    阅读次数:97
【Tree】已知前序和中序遍历还原二叉树
1 /************************** 2 https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ 3 @date 2015.5.16 4 @descrip....
分类:其他好文   时间:2015-05-16 18:16:24    阅读次数:167
[LeetCode][Java]Maximum Depth of Binary Tree
https://leetcode.com/problems/maximum-depth-of-binary-tree/Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth i...
分类:编程语言   时间:2015-05-16 18:11:43    阅读次数:124
[LeetCode][Java]Same Tree
https://leetcode.com/problems/same-tree/Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are consi...
分类:编程语言   时间:2015-05-16 18:07:57    阅读次数:130
【Unique Binary Search Trees II】cpp
题目:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 ...
分类:其他好文   时间:2015-05-16 17:57:57    阅读次数:107
[LeetCode]Binary Tree Inorder Traversal
题意:题意比较简单就是二叉树的中序遍历 思路:1. 递归是最简单的了    2. 非递归的实现:用一个stack做存储结构 一直查找leftchild 知道没有下一个leftchild,访问该元素 如果该元素有right child 加入stack 从stack中取出一个元素 重复上述行为(这里需要加入set集合记录访问过得left的节点 否则会出现重复访问的问题) 代码: ...
分类:其他好文   时间:2015-05-16 16:34:34    阅读次数:100
【Unique Binary Search Trees】cpp
题目:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. ...
分类:其他好文   时间:2015-05-16 16:23:31    阅读次数:92
Java for LeetCode 067 Add Binary
Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".解题思路:JAVA实现如下:static public String addBinar...
分类:编程语言   时间:2015-05-16 13:16:18    阅读次数:172
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!