题目:给定一个棵树,将其转换成flattened tree。只有右节点的,类似于链表,且在原址操作。例如:Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look l...
分类:
其他好文 时间:
2014-11-30 18:38:38
阅读次数:
209
/bin 可执行二进制文件binary 如 cp 所有用户都有权限执行/boot 启动目录 加载内核vmlinuz/dev 计算机上所有的设备 抽象为文件 sda1/etc 所有配置configuration文件/home 家目录 每个用户在home下都有一个专门文件夹 保存该用户的东西root是....
分类:
系统相关 时间:
2014-11-30 18:35:26
阅读次数:
246
Binary Tree Zigzag Level Order TraversalGiven a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then...
分类:
其他好文 时间:
2014-11-30 18:29:54
阅读次数:
204
Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume...
分类:
其他好文 时间:
2014-11-30 16:46:40
阅读次数:
150
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-11-30 16:42:57
阅读次数:
200
Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assu...
分类:
其他好文 时间:
2014-11-30 15:20:40
阅读次数:
128
摘要本文主要讨论的内容包括:BST的性质以及基本操作分析。作为最基本的数据结构,二叉查找树(后文记为BST)本身不仅易于理解,代码精简,而且通过添加不同的特性,可以实现许多高级的数据结构,例如:添加颜色信息,升级为红黑树;添加高度和平衡信息,升级为AVL树;更改节点数量,成为2-3-4树等更为复杂的...
分类:
其他好文 时间:
2014-11-30 13:52:12
阅读次数:
408
和上一题类似,这里是要记录每条路径并返回结果。Given the below binary tree andsum = 22, 5 / \ 4 8 / / \ 11 13 4 ...
分类:
其他好文 时间:
2014-11-30 13:44:42
阅读次数:
188
判断一棵树是不是平衡二叉树。思路:递归。每个节点的左右子树是平衡二叉树,并且左右子树的高度相差不超过一。/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * Tr...
分类:
其他好文 时间:
2014-11-30 00:24:11
阅读次数:
288
题目:返回根节点到最近的叶子节点的距离。例如:{1,2},其中2是1的左子树,1的右子树为空,2为叶子节点,那么此时返回2.如果用简单的递归,以为是返回左右两边的最小值加1,那么上面那个case就错了,因为如果返回左右两边最小值加1的话,上面1的右边是0,所以返回1,但我们想要的是2.所以要另外注意...
分类:
其他好文 时间:
2014-11-30 00:22:57
阅读次数:
118