码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
Path Sum II
Description: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 t...
分类:其他好文   时间:2015-07-04 18:21:09    阅读次数:91
[Leetcode]-Path Sum
Given 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 given sum.For example: Given the below binary tree and sum = 2...
分类:其他好文   时间:2015-07-04 15:32:56    阅读次数:95
Binary search
Binary SearchJonBentley以前说过类似的话:“90%的程序猿无法正确实现二分查找算法就冲着这句话去写binary searchbinary_search 的算法实现部分/*******************************************************...
分类:其他好文   时间:2015-07-04 15:15:53    阅读次数:86
[LeetCode] Binary Tree Zigzag Level Order Traversal
To be honest, I do not know whether this problem is designed to let you use stacks. Anyway, I don't. Here are my codes, both BFS and DFS version. 1 .....
分类:其他好文   时间:2015-07-04 12:27:08    阅读次数:115
Binary String Matching
描述:Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as a substring of B? For...
分类:其他好文   时间:2015-07-04 10:57:26    阅读次数:99
[LeetCode] Median of Two Sorted Arrays
This link has a very concise and fast solution based on binary search. Spend some time reading it and make sure you understand it. It is very helpful....
分类:其他好文   时间:2015-07-04 00:41:54    阅读次数:120
Path Sum
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class...
分类:其他好文   时间:2015-07-03 23:31:49    阅读次数:358
LeetCode Binary Tree Level Order Traversal II (二叉树颠倒层序)
题意:从左到右统计将同一层的值放在同一个容器vector中,要求上下颠倒,左右不颠倒。思路:广搜逐层添加进来,最后再反转。 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5...
分类:其他好文   时间:2015-07-03 23:19:55    阅读次数:139
Minimum Depth of Binary Tree
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class...
分类:其他好文   时间:2015-07-03 22:09:52    阅读次数:127
LeetCode Invert Binary Tree 反转二叉树
思路:递归解决,在返回root前保证该点的两个孩子已经互换了。注意可能给一个Null。 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *...
分类:其他好文   时间:2015-07-03 22:00:31    阅读次数:232
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!