上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 28 下一页

2015年5月16日

摘要: 题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.代码:/** * Definition for singly-linked ... 阅读全文
posted @ 2015-05-16 21:23 承续缘 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.代码:/** * Definition for a binary tree node. * stru... 阅读全文
posted @ 2015-05-16 20:13 承续缘 阅读(192) 评论(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 onl... 阅读全文
posted @ 2015-05-16 18:15 承续缘 阅读(196) 评论(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 ... 阅读全文
posted @ 2015-05-16 16:56 承续缘 阅读(212) 评论(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. ... 阅读全文
posted @ 2015-05-16 15:38 承续缘 阅读(220) 评论(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.代码:/** * De... 阅读全文
posted @ 2015-05-16 11:43 承续缘 阅读(153) 评论(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.代码:/** * Def... 阅读全文
posted @ 2015-05-16 11:14 承续缘 阅读(143) 评论(0) 推荐(0) 编辑

2015年5月15日

摘要: 题目: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 s... 阅读全文
posted @ 2015-05-15 11:41 承续缘 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattene... 阅读全文
posted @ 2015-05-15 09:54 承续缘 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / ... 阅读全文
posted @ 2015-05-15 09:32 承续缘 阅读(209) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 28 下一页

导航