码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
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 constant ...
分类:其他好文   时间:2015-01-04 13:37:37    阅读次数:139
Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / 2 5 / \ 3 4 6 The flattened tree should look like: 1 ...
分类:其他好文   时间:2015-01-04 12:12:13    阅读次数:128
[LeetCode]67 Add Binary
https://oj.leetcode.com/problems/add-binary/http://blog.csdn.net/linhuanmars/article/details/20192227publicclassSolution{ publicStringaddBinary(Stringa,Stringb){ StringBuildersb=newStringBuilder(); char[]charsA=a.toCharArray(); char[]charsB=b.toCharArray(..
分类:其他好文   时间:2015-01-04 11:35:00    阅读次数:156
二分算法总结
讨论分为3种,第一种是搜索队列中任意我们需求的结果,第三种我们需求队列中有多个返回第一个,第四种未我们搜索队列中有多个返回最后一个元素的index。 第一种: 在一行排好序队列a中搜索target,一定有。 int binarySearch(int a[],int n, int target) { int start = 0,end = n-1; while(start...
分类:编程语言   时间:2015-01-04 11:31:06    阅读次数:152
数据结构——AVL平衡树
1、是二叉搜索树(Binary Search Tree)2、树和所有左右子树高度之差为-1,0,1平衡因子(balance factor) =右子树高度-左子树高度平衡化旋转: 1、从插入位置向根节点计算节点的平衡因子; 2、若发现不平衡点(即平衡因子绝对值大于1),从此节点向下取两层; 3...
分类:其他好文   时间:2015-01-04 01:07:09    阅读次数:421
Leetcode: Binary Search Tree Iterator
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 next smallest number in the BST. Note: next()...
分类:其他好文   时间:2015-01-03 22:26:17    阅读次数:219
LeetCode--Path Sum
题目: 解决方案: /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solu...
分类:其他好文   时间:2015-01-03 19:53:41    阅读次数:181
LeetCode: Construct Binary Tree from Inorder and Postorder Traversal 解题报告
Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assu...
分类:其他好文   时间:2015-01-03 17:18:44    阅读次数:136
leetcode 156: Binary Tree Upside Down
Binary Tree Upside Down Total Accepted: 813 Total Submissions: 2515 Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent ...
分类:其他好文   时间:2015-01-03 15:58:52    阅读次数:134
[LeetCode]173.Binary Search Tree Iterator
【题目】 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 next smallest number in the BST. No...
分类:其他好文   时间:2015-01-03 12:00:06    阅读次数:161
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!