Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni...
分类:
其他好文 时间:
2015-07-30 01:58:55
阅读次数:
171
华电北风吹
天津大学认知计算与应用重点实验室
完成日期:2015/7/29Double-base palindromes
Problem 36
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.Find the sum of all numbers, less than one milli...
分类:
其他好文 时间:
2015-07-30 00:50:29
阅读次数:
139
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:
其他好文 时间:
2015-07-30 00:26:06
阅读次数:
182
题目:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), retu...
分类:
其他好文 时间:
2015-07-30 00:18:26
阅读次数:
203
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined
betw...
分类:
其他好文 时间:
2015-07-29 23:04:12
阅读次数:
132
这里可以使用queue在有的地方看大使用两个queue,一个queue保存上面哪一层的node,然后另外一个临时queue在保存那个queue的孩子节点,最后当第一个queue遍历完了之后,在将其放到第一个queue当中。在[1]当中发现,没有必要这样做,实际上在开始遍历queue的时候,里面的no...
分类:
其他好文 时间:
2015-07-29 22:41:00
阅读次数:
163
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Analyse: The l...
分类:
其他好文 时间:
2015-07-29 22:37:52
阅读次数:
112
Unique Binary Search Trees II
原题:
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should...
分类:
其他好文 时间:
2015-07-29 21:23:20
阅读次数:
101
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
For example:
Given the following binary tree,
1...
分类:
其他好文 时间:
2015-07-29 21:18:23
阅读次数:
93
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Analyse: We can...
分类:
其他好文 时间:
2015-07-29 21:16:40
阅读次数:
168