Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.Hide Tags :Tree ,De...
分类:
其他好文 时间:
2015-07-06 12:25:10
阅读次数:
114
题目:
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 tree...
分类:
编程语言 时间:
2015-07-06 12:18:44
阅读次数:
94
本文共列出了11个常见的二叉树遍历算法。二叉树的遍历主要有深度优先遍历和广度优先遍历。深度优先遍历包含前序遍历、中序遍历和后序遍历。值得一提的是, 其中的 Morris 算法 可以线性时间不需要额外空间(用户栈或系统栈空间)实现二叉树的前序遍历、中序遍历和后序遍历。关于Morris算法, 可参考ht...
分类:
编程语言 时间:
2015-07-06 11:41:08
阅读次数:
252
Binary Tree TraversalsTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3340Accepted Submission(s): ...
分类:
其他好文 时间:
2015-07-06 11:36:29
阅读次数:
72
一、注册表基本知识
1) 结构
键->项->子项->值项(名称、类型、数据)
REG_SZ 字符串
REG_BINARY 二进制
REG_DWORD 双字
2) 组成
1.HKEY_CLASSES_ROOT 定义了系统中所有文件类型标识和基本操作标识
该主键包含文件扩展名和应用程序...
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-06 06:37:44
阅读次数:
125
Add Binary
Total Accepted: 46815
Total Submissions: 189215
My Submissions
Given two binary strings, return their sum (also a binary string).
For example,
a =...
分类:
其他好文 时间:
2015-07-05 22:35:34
阅读次数:
228
解法一:递归1 int maxDepth(TreeNode* root)2 {3 if (root == NULL)4 return 0;5 6 int max_left_Depth = maxDepth(root->left);7 int max_right...
分类:
其他好文 时间:
2015-07-05 18:31:24
阅读次数:
101
解法一:From top to bottom 1 int treeHeight(TreeNode *T) 2 { 3 if (T == NULL) 4 return 0; 5 6 return max(treeHeight(T->left), treeHei...
分类:
其他好文 时间:
2015-07-05 18:23:33
阅读次数:
82
Given a binary search tree, write a function kthSmallestto find the kth
smallest element in it.
Note:
You may assume k is always valid, 1 ≤ k ≤ BST's total elements.
解题思路:
求BST(二叉排序树)中第k小的数...
分类:
其他好文 时间:
2015-07-05 16:53:00
阅读次数:
150