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 only n...
分类:
其他好文 时间:
2015-07-03 13:55:42
阅读次数:
97
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class...
分类:
其他好文 时间:
2015-07-03 12:29:21
阅读次数:
132
67 Add Binary链接:https://leetcode.com/problems/add-binary/
问题描述:
Given two binary strings, return their sum (also a binary string).For example,
a = “11”
b = “1”
Return “100”.Hide Tags Math String求两...
分类:
其他好文 时间:
2015-07-03 10:42:39
阅读次数:
126
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class...
分类:
其他好文 时间:
2015-07-03 10:37:38
阅读次数:
149
步骤1.创建工程HLStaticTest
步骤2.创建静态库文件
步骤3. 关闭HLStatic,回到HLStaticTest
Targets - 》Build Phases ->Link Binary With Libraries
然后进...
分类:
其他好文 时间:
2015-07-03 09:25:10
阅读次数:
213
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他好文 时间:
2015-07-03 06:55:11
阅读次数:
121
Kth Smallest Element in a BSTGiven a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is alw...
分类:
编程语言 时间:
2015-07-03 00:07:34
阅读次数:
188
平衡二叉树(Balanced Binary Tree)又被称为AVL树(有别于AVL算法),且具有以下性质:它是一 棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树。构造与调整方法 平衡二叉树的常用算法有红黑树、AVL、Treap等。 最小二叉平衡树的节点的公式如下 F(n)=F(n-1)+F(n-2)+1 这个类似于一个递归的数列,可以参考Fibonacci数列...
分类:
其他好文 时间:
2015-07-02 22:48:29
阅读次数:
487
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note:
You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.Follow up:
What if the BST is mod...
分类:
其他好文 时间:
2015-07-02 22:37:12
阅读次数:
129
Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota...
分类:
其他好文 时间:
2015-07-02 22:30:24
阅读次数:
263