The problem:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2...
分类:
其他好文 时间:
2015-01-10 12:33:00
阅读次数:
236
Problem 1 [Balanced Binary Tree]Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as ...
分类:
其他好文 时间:
2015-01-10 06:36:11
阅读次数:
290
Pat1086代码
题目描述:
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6...
分类:
其他好文 时间:
2015-01-09 23:45:43
阅读次数:
201
ByteOrder: 1 #include 2 3 int main(int argc, char**argv) 4 { 5 union { 6 short s; 7 char c[sizeof(short)]; 8 } un; 9 ...
分类:
Web程序 时间:
2015-01-09 23:34:47
阅读次数:
196
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST....
分类:
其他好文 时间:
2015-01-09 22:29:55
阅读次数:
181
Minimum Depth of Binary Tree...
分类:
其他好文 时间:
2015-01-09 21:02:38
阅读次数:
175
1. 概念:Binary-search tree(BST)是一颗二叉树,每个树上的节点都有parent.left.key。但找到x的parent就结束了吗,还没有,就像TREE-MINIMUM函数一样,我们需要逐层查找,当找到符合条件的parent后,我们递归的继续检查parent节点有没有pare...
分类:
编程语言 时间:
2015-01-09 20:48:25
阅读次数:
219
https://oj.leetcode.com/problemset/algorithms/http://siddontang.gitbooks.io/leetcode-solution/content/array/find_peak_element.htmlpublicclassSolution{
publicintfindPeakElement(int[]num){
//SolutionA:
returnfindPeakElement_Binary(num);
//SolutionB:
//retur..
分类:
其他好文 时间:
2015-01-09 19:31:41
阅读次数:
202
https://oj.leetcode.com/problems/binary-tree-upside-down/http://blog.csdn.net/xudli/article/details/42362441/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolution{
publicT..
分类:
其他好文 时间:
2015-01-09 19:29:33
阅读次数:
169