上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 40 下一页
摘要: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.Analyse: the core idea of this problem is... 阅读全文
posted @ 2015-07-31 11:44 amazingzoe 阅读(174) 评论(0) 推荐(0)
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Analyse: Using binary search to divide the sorted arr... 阅读全文
posted @ 2015-07-31 10:38 amazingzoe 阅读(170) 评论(0) 推荐(0)
摘要: 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 n... 阅读全文
posted @ 2015-07-30 11:10 amazingzoe 阅读(132) 评论(0) 推荐(0)
摘要: 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... 阅读全文
posted @ 2015-07-30 00:32 amazingzoe 阅读(129) 评论(0) 推荐(0)
摘要: 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... 阅读全文
posted @ 2015-07-29 23:27 amazingzoe 阅读(153) 评论(0) 推荐(0)
摘要: 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... 阅读全文
posted @ 2015-07-29 21:27 amazingzoe 阅读(169) 评论(0) 推荐(0)
摘要: 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... 阅读全文
posted @ 2015-07-29 20:22 amazingzoe 阅读(214) 评论(0) 推荐(0)
摘要: Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution stil... 阅读全文
posted @ 2015-07-28 17:56 amazingzoe 阅读(153) 评论(0) 推荐(0)
摘要: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe... 阅读全文
posted @ 2015-07-28 17:29 amazingzoe 阅读(147) 评论(0) 推荐(0)
摘要: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2015-07-28 17:07 amazingzoe 阅读(113) 评论(0) 推荐(0)
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 40 下一页