码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
【树】Kth Smallest Element in a BST(递归)
题目: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ B
分类:其他好文   时间:2016-01-29 16:05:13    阅读次数:141
Lowest Common Ancestor of a Binary Search Tree -- LeetCode
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
分类:其他好文   时间:2016-01-29 15:48:10    阅读次数:128
【树】Lowest Common Ancestor of a Binary Tree(递归)
题目: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The l
分类:其他好文   时间:2016-01-29 12:24:06    阅读次数:125
【树】Path Sum II(递归)
题目: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example:Given the below binary tree and
分类:其他好文   时间:2016-01-29 11:56:46    阅读次数:123
Gray Code -- LeetCode
The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total num
分类:其他好文   时间:2016-01-29 11:43:39    阅读次数:133
Binary Tree Iterative Traversal
Preorder class Solution { public: vector<int> preorderTraversal(TreeNode* root) { vector<int> res; if (!root) return res; stack<TreeNode *> sta; sta.p
分类:其他好文   时间:2016-01-29 11:31:25    阅读次数:118
Binary Tree Preorder Traversal -- LeetCode
Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. 思路:递归和迭代。
分类:其他好文   时间:2016-01-29 08:46:37    阅读次数:117
Binary Tree Zigzag Level Order Traversal -- LeetCode
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and
分类:其他好文   时间:2016-01-29 08:43:45    阅读次数:165
Jan 28 - Construct Binary Tree From Preorder And Inorder; Tree; DFS; Array
Using DFS to traverse the node and build the a tree. for a node, it has following properties: If its a left child node of its parent, then the left bo
分类:其他好文   时间:2016-01-29 08:42:46    阅读次数:168
Binary Search Tree Iterator leetcode
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n
分类:其他好文   时间:2016-01-29 00:17:27    阅读次数:197
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!