码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
Leetcode#173 Binary Search Tree Iterator
原题地址普遍的做法是:用栈保存从根节点到当前尚未遍历过的最小节点的路径(栈顶始终是最小节点)constructor:遍历至最小节点,同时将路径上出现的节点压栈保存hasNext:返回栈里面是否还有元素next:栈顶元素即为所求,弹栈的同时更新栈,使栈里始终保存的是从根节点到剩余未遍历节点的最小节点的...
分类:其他好文   时间:2015-01-27 07:00:41    阅读次数:184
[LeetCode] Binary Tree Postorder Traversal 二叉树的后序遍历
Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,...
分类:其他好文   时间:2015-01-27 01:51:12    阅读次数:198
【leetcode】Add Binary
Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".Hide TagsMathString先补全字符串,从末尾开始加,每次计算...
分类:其他好文   时间:2015-01-27 00:30:35    阅读次数:142
【leetcode】Validate Binary Search Tree
Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre...
分类:其他好文   时间:2015-01-27 00:29:27    阅读次数:205
【leetcode】Unique Binary Search Trees
Unique Binary Search TreesGivenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a to...
分类:其他好文   时间:2015-01-27 00:16:11    阅读次数:218
【leetcode】Symmetric Tree
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric...
分类:其他好文   时间:2015-01-27 00:14:03    阅读次数:145
uva 575 Skew Binary(数论)
uva 575 Skew Binary When a number is expressed in decimal, the k-th digit represents a multiple of 10k. (Digits are numbered from right to left, where the least significant digit is number 0.) ...
分类:其他好文   时间:2015-01-26 23:01:06    阅读次数:373
Convert Sorted Array to Binary Search Tree
题目: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 我的解法: (1)算法思想: 二分法,数组的中间点为根节点,然后递归。 (2)代码如下: {CSDN:CODE:589537}...
分类:其他好文   时间:2015-01-26 19:21:31    阅读次数:136
Binary Tree Postorder Traversal
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].这道...
分类:其他好文   时间:2015-01-26 16:41:21    阅读次数:118
[C++]LeetCode: 124 Populating Next Right Pointers in Each Node II(链接二叉树)
题目: 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 still work? Note: You may only use co...
分类:编程语言   时间:2015-01-26 13:41:55    阅读次数:253
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!