Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution stil...
分类:
其他好文 时间:
2015-07-22 22:11:30
阅读次数:
101
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x...
分类:
其他好文 时间:
2015-07-22 20:37:42
阅读次数:
92
Invert Binary TreeTotal Accepted:22352Total Submissions:62065My SubmissionsQuestionSolutionInvert a binary tree. 4 / \ 2 7 / \ / \1 3...
分类:
其他好文 时间:
2015-07-22 20:35:16
阅读次数:
103
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2015-07-22 20:20:26
阅读次数:
129
原体如下:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tr...
分类:
其他好文 时间:
2015-07-22 18:45:58
阅读次数:
87
http://www.geeksforgeeks.org/in-place-convert-a-given-binary-tree-to-doubly-linked-list/Given a Binary Tree (Bt), convert it to a Doubly Linked List(D...
分类:
其他好文 时间:
2015-07-22 18:32:21
阅读次数:
103
http://www.geeksforgeeks.org/lowest-common-ancestor-in-a-binary-search-tree/Lowest Common Ancestor in a Binary Search Tree.Given values of two nodes i...
分类:
其他好文 时间:
2015-07-22 18:18:44
阅读次数:
103
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.
直观地一想,查找第k小的数,不就是...
分类:
其他好文 时间:
2015-07-22 16:22:04
阅读次数:
87
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ 2 2
/ \ / 3 4 4 3
But the f...
分类:
其他好文 时间:
2015-07-22 16:10:25
阅读次数:
102
http://www.geeksforgeeks.org/bottom-view-binary-tree/Bottom View of a Binary TreeGiven a Binary Tree, we need to print the bottom view from left to ri...
分类:
其他好文 时间:
2015-07-22 16:00:20
阅读次数:
109