二分查找代码://============================================================================// Name : BinarySearch.cpp// Author : Danny// Version...
分类:
其他好文 时间:
2015-05-24 06:29:07
阅读次数:
188
Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened ...
分类:
编程语言 时间:
2015-05-23 22:40:17
阅读次数:
190
Search in a Binary Search TreeTo search a key in a binary search tree, we start from the root and move all the way down, choosing branches according t...
分类:
其他好文 时间:
2015-05-23 22:30:29
阅读次数:
169
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-05-23 21:22:23
阅读次数:
152
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth...
分类:
编程语言 时间:
2015-05-23 21:19:39
阅读次数:
155
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le...
分类:
编程语言 时间:
2015-05-23 21:16:50
阅读次数:
170
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum ...
分类:
编程语言 时间:
2015-05-23 21:16:11
阅读次数:
196
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解题思路:同上题,JAVA实现如下: public TreeNode sor...
分类:
编程语言 时间:
2015-05-23 21:13:59
阅读次数:
145
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.解题思路:首先要理解,什么叫做height balanced BST,然后就十分容易了,JAVA实现如下:...
分类:
编程语言 时间:
2015-05-23 19:58:52
阅读次数:
146
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For ...
分类:
编程语言 时间:
2015-05-23 19:58:45
阅读次数:
170