码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
LeetCode - Binary Search Tree Iterator
Binary Search Tree Iterator2015.1.23 18:58Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node ...
分类:其他好文   时间:2015-01-23 21:21:40    阅读次数:197
Flatten Binary Tree to Linked List (DFS)
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:其他好文   时间:2015-01-23 21:17:22    阅读次数:252
Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路比较简单,就是每次以中位数为根节点,然后左边即左子树,右边是右子树,递归下去即可超时代码(不知道为啥)...
分类:其他好文   时间:2015-01-23 19:56:34    阅读次数:202
Unique Binary Search Trees(dp)
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.....
分类:其他好文   时间:2015-01-23 18:16:13    阅读次数:236
Binary Tree Inorder Traversal
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:其他好文   时间:2015-01-23 17:46:36    阅读次数:121
[C++]LeetCode: 118 Find Peak Element (二分查找 寻找数组局部峰值)
题目: A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its index. The array may contain multiple pea...
分类:编程语言   时间:2015-01-23 16:22:13    阅读次数:185
【LeetCode】Minimum Depth of Binary Tree 二叉树的最小深度 java
【LeetCode】Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path fro...
分类:编程语言   时间:2015-01-23 12:40:08    阅读次数:146
LeetCode Binary Search Tree Iterator
class BSTIterator {private: TreeNode* current; stack nodeStack;public: BSTIterator(TreeNode *root) { current = root; } /** @retu...
分类:其他好文   时间:2015-01-23 00:37:56    阅读次数:226
Flatten Binary Tree to Linked List
随笔一记,留做重温!Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 ...
分类:其他好文   时间:2015-01-22 19:38:34    阅读次数:219
【LeetCode】Binary Tree Maximum Path Sum 解题报告
【题目】 Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example: Given the below binary tree, 1 / 2 3 Re...
分类:其他好文   时间:2015-01-22 18:16:26    阅读次数:130
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!