码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
leetcode || 69、Sqrt(x)
problem: Implement int sqrt(int x). Compute and return the square root of x. Hide Tags  Math Binary Search 题意:计算平方根,没有指定精度,默认精度为0.00001 thinking: (1)由于...
分类:其他好文   时间:2015-04-08 10:56:36    阅读次数:192
leetcode:Path Sum II
又一道DFS题,题意如下: 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 sum = 22, 5 ...
分类:其他好文   时间:2015-04-08 09:12:40    阅读次数:116
leetcode:Populating Next Right Pointers in Each Node
一道DFS的题目,题意如下: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 1...
分类:其他好文   时间:2015-04-08 09:12:29    阅读次数:107
[Leetcode][JAVA] Minimum Depth of Binary Tree && Balanced Binary Tree
Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root...
分类:编程语言   时间:2015-04-08 07:55:25    阅读次数:137
190. Reverse Bits
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:其他好文   时间:2015-04-08 07:55:03    阅读次数:150
199. Binary Tree Right Side View
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:其他好文   时间:2015-04-08 07:52:00    阅读次数:91
[Leetcode][JAVA] Path Sum I && II
Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the give...
分类:编程语言   时间:2015-04-08 06:35:37    阅读次数:186
LeetCode --- 89. Gray Code
题目链接:Gray Code 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 number of bits in the code, print th...
分类:其他好文   时间:2015-04-07 23:34:18    阅读次数:318
LeetCode --- 87. Scramble String
题目链接:Scramble String Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": ...
分类:其他好文   时间:2015-04-07 23:33:46    阅读次数:556
二分查找
1 int binary_search(int* a, int len, int goal) 2 { 3 int low = 0; 4 int high = len - 1; 5 while(low goal)12 high = middle - ...
分类:其他好文   时间:2015-04-07 23:11:31    阅读次数:134
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!