码迷,mamicode.com
首页 >  
搜索关键字:binary tree    ( 23211个结果
CTCI 4.5
Implement a function to check if a binary tree is a binary search tree./* The inorder travel of a BST is strictly increasing. We track the pre node of...
分类:其他好文   时间:2014-07-13 22:27:09    阅读次数:344
Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [3,2,1]. Note: Recursive solut...
分类:其他好文   时间:2014-07-13 17:18:19    阅读次数:193
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric:...
分类:其他好文   时间:2014-07-13 17:13:49    阅读次数:213
Validate Binary Search Tree
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 nodes with keys less than the node's key.Th...
分类:其他好文   时间:2014-07-13 16:53:01    阅读次数:189
【 D3.js 入门系列 --- 9 】 常见可视化图形
Layout 是 D3 中 “制作常见图形的函数”,用 Layout 可以轻松地对输入数据进行转换,使得它能容易地适应可视化图形使用的需要。...
分类:Web程序   时间:2014-07-13 16:30:01    阅读次数:294
Same Tree
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. /** * Defin...
分类:其他好文   时间:2014-07-13 15:50:25    阅读次数:158
zoj2334 Monkey King , 并查集,可并堆,左偏树
提交地址:点击打开链接 题意:  N(N 分析:涉及集合的查询,合并,取最值。 利用并查集和左偏树即可解决。 #include #include #include #include using namespace std; const int maxn = 200000; int tot, v[maxn], l[maxn], r[maxn], d[maxn], f[...
分类:其他好文   时间:2014-07-13 15:38:55    阅读次数:183
Path Sum
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 and sum ...
分类:其他好文   时间:2014-07-13 13:58:01    阅读次数:184
CTCI 4.7
Design an algorithm and write code to find the first common ancestory of two nodes in a binary tree. Avoid storing additional nodes in data structure....
分类:其他好文   时间:2014-07-13 13:24:21    阅读次数:279
CTCI 4.8
You have two very large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of ...
分类:其他好文   时间:2014-07-13 13:04:00    阅读次数:186
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!