題目描述:题目链接:102-Binary Tree Level Order Traversal这个问题要解决的是如何逐层遍历一个二叉树,并把同一层元素放入同一list中, 再将所有元素返回。其实当时我的第一个反应就是树类型的题目已经做了好多了,无非用来用去就是递归,或者队列,那如何解决这个问题呢?先...
分类:
其他好文 时间:
2015-09-01 14:04:45
阅读次数:
188
想写点什么, 因为这道题花了我好几个小时, 在周日, 除了在球场上跑了二个小时, 就泡在这道题上面.read blogs:http://www.lifeincode.net/programming/leetcode-recover-binary-search-tree-java/http://www...
分类:
编程语言 时间:
2015-09-01 13:54:11
阅读次数:
157
树状数组的原英文表达:Binary Indexed Tree(BIT),直译的意思便是:二进制标记树如果数组A是基础数组,数组C是区间数组。那么,在具体介绍数组C的特点前,先给出如下的树状关系图:仔细观察上图,容易发现:数组C[]分别代表的区间为:C1=A1 [1,1]C2=C1+A2=A1+A2 ...
分类:
编程语言 时间:
2015-09-01 12:33:07
阅读次数:
346
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Solution:If you would have to choose an array element...
分类:
其他好文 时间:
2015-09-01 08:02:48
阅读次数:
136
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-09-01 08:01:08
阅读次数:
175
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2015-09-01 08:00:49
阅读次数:
113
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest...
分类:
其他好文 时间:
2015-09-01 01:43:21
阅读次数:
157
ASCII Extended CharactersSymbol Decimal Binary Ç 128 10000000 ü 129 10000001 é 130 10000010 â 131 10000011 ä 132 10000100 à 133 10000101 å 134 1000011...
分类:
其他好文 时间:
2015-08-31 23:14:46
阅读次数:
132
从0开始计数,而不是1的原因:
数字系统被简化为只有0与1的基本思想,无论0还是1都占据一个位数,都有和它相关的权数。自然,我们就从0开始计数。否则就浪费了一个比特位。
比特(BIT)是binary digit的简写,从0到1的数字,而bi表示2.所以就有两个数字,因此bit诞生了。
ASCII码,可以表示键盘上的字符。
8个bit是一个byte,可以表达256个可能的字符,可以包含整个美...
分类:
编程语言 时间:
2015-08-31 17:22:55
阅读次数:
293
题目:
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
1
/ 2 3
5
All root-to-leaf paths are:
["1->2->5", "1->3"]...
分类:
其他好文 时间:
2015-08-31 15:16:29
阅读次数:
161