构造
文章平均质量分 68
jmspan
这个作者很懒,什么都没留下…
展开
-
LeetCode 105. Construct Binary Tree from Preorder and Inorder Traversal(从前序遍历和中序遍历构造二叉树)
原题网址:https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume t原创 2016-05-24 00:12:34 · 457 阅读 · 0 评论 -
LeetCode 106. Construct Binary Tree from Inorder and Postorder Traversal(根据中序遍历和后序遍历构造二叉树)
原题网址:https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume原创 2016-05-24 00:12:37 · 459 阅读 · 0 评论 -
LeetCode 108. Convert Sorted Array to Binary Search Tree(数组转换为二叉搜索树)
原题网址:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/Given an array where elements are sorted in ascending order, convert it to a height balanced BST.方法:递归,自顶向下。/** *原创 2016-05-24 00:12:53 · 498 阅读 · 0 评论 -
LeetCode 95. Unique Binary Search Trees II(唯一二叉搜索树)
原题网址:https://leetcode.com/problems/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原创 2016-05-23 00:35:30 · 495 阅读 · 0 评论 -
LeetCode 96. Unique Binary Search Trees(唯一二叉树)
原题网址:https://leetcode.com/problems/unique-binary-search-trees/Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a原创 2016-05-23 00:38:28 · 393 阅读 · 0 评论 -
LeetCode 109. Convert Sorted List to Binary Search Tree(链表到二叉搜索树)
原题网址:https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.方法:使用慢指针原创 2016-05-24 00:12:46 · 587 阅读 · 0 评论