码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
[Leetcode][JAVA] Sum Root to Leaf Numbers
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:编程语言   时间:2014-10-27 08:10:18    阅读次数:196
Same Tree 判断相同树
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:其他好文   时间:2014-10-27 08:09:30    阅读次数:167
[Leetcode] Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Solution:/** * Definition for binary tree * public cl...
分类:其他好文   时间:2014-10-27 06:51:31    阅读次数:137
BestCoder15 1002.Instruction(hdu 5083) 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5083题目意思:如果给出 instruction 就需要输出对应的16-bit binary code,给出16-bit binary code 就需要输出对应的instruction。 由于不会截取的....
分类:其他好文   时间:2014-10-27 00:15:41    阅读次数:354
HDOJ 4010 Query on The Trees LCT
LCT: 切割、合并子树,路径上所有点的点权增加一个值,查询路径上点权的最大值 Query on The Trees Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 2582    Accepted Submissi...
分类:其他好文   时间:2014-10-26 23:01:39    阅读次数:368
二分查找 Binary Search
简单地用递归的方法实现了二分查找算法,适用于数组。二分查找算法的前提条件是数组本身是有序的,比如int arr[6] = {2, 3, 5, 7, 11, 13}; 1 int 2 BinarySearch(int arr[], int key, int left, int right) 3 { 4...
分类:其他好文   时间:2014-10-26 22:47:44    阅读次数:232
LeetCode: Add Binary 解题报告
Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".SOLUTION:指针指到两个字符串的末尾,不断往前推进,用carr...
分类:其他好文   时间:2014-10-26 22:40:47    阅读次数:339
常用算法
二分查找int binary_search(int a[],int len,int goal){ int beg = 0; int end = len - 1; while(beg goal) end = middle - 1; else ...
分类:编程语言   时间:2014-10-26 18:17:20    阅读次数:145
[Leetcode] Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:其他好文   时间:2014-10-26 15:33:29    阅读次数:141
[leetcode]Path Sum II
问题描述: 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 /...
分类:其他好文   时间:2014-10-26 14:24:00    阅读次数:224
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!