![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Tree
duffywan
这个作者很懒,什么都没留下…
展开
-
Validate Binary Search Tree
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 nodes with keys less than the node's key.Th原创 2014-11-07 14:00:38 · 187 阅读 · 0 评论 -
Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.Idea: u原创 2014-11-06 03:24:44 · 207 阅读 · 0 评论 -
Construct Binary Tree from Preorder and Inorder Traversal
Fair Construct Binary Tree from Preorder and Inorder TraversalShow Result My Submissions35%AcceptedGiven preorder and inorder traversal of a tree, construct the binary tree.原创 2014-11-20 04:36:18 · 322 阅读 · 0 评论 -
Binary Tree Level Order Traversal II
/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; * this.left =原创 2014-11-17 10:09:48 · 210 阅读 · 0 评论 -
Binary Tree Zigzag Level Order Traversal
Fair Binary Tree Zigzag Level Order TraversalShow Result My Submissions29%AcceptedGiven a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from原创 2014-11-17 10:38:04 · 297 阅读 · 0 评论 -
Construct Binary Tree from Inorder and Postorder Traversal
Fair Construct Binary Tree from Inorder and Postorder TraversalShow Result My Submissions37%AcceptedGiven inorder and postorder traversal of a tree, construct the binary tree原创 2014-11-20 05:31:21 · 279 阅读 · 0 评论 -
Lowest Common Ancestor
Fair Lowest Common AncestorMy Submissions32%AcceptedGiven the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes.The lowest common ances原创 2014-11-17 07:09:40 · 220 阅读 · 0 评论 -
Binary Tree Maximum Path Sum
Fair Binary Tree Maximum Path SumShow Result My Submissions22%AcceptedGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.原创 2014-11-17 05:08:58 · 333 阅读 · 0 评论 -
Binary Tree Level Order Traversal
Fair Binary Tree Level Order TraversalShow Result My Submissions30%AcceptedGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left to right原创 2014-11-17 09:46:26 · 218 阅读 · 0 评论 -
Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.public class Solution { public TreeNode sortedArrayToBST(int[] num) { if (num == null) return nu原创 2014-11-07 23:49:25 · 280 阅读 · 0 评论 -
Convert Sorted List to Binary Search Tree
Problem :Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.转载 2014-11-24 06:17:09 · 242 阅读 · 0 评论