码迷,mamicode.com
首页 >  
搜索关键字:hdoj tree    ( 20544个结果
【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...
分类:其他好文   时间:2014-06-22 20:59:24    阅读次数:227
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 / 3 return [3,2,1]. Note: Recursive solut...
分类:其他好文   时间:2014-06-22 20:58:01    阅读次数:157
HDOJ 1054 Strategic Game
二分图匹配: 最大匹配数=最大独立集=最小点覆盖 最小路径覆盖=点数-最大匹配数 Strategic Game Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4739    Accepted Submission(...
分类:其他好文   时间:2014-06-22 17:55:06    阅读次数:163
POJ2405-Beavergnaw
Beavergnaw Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6204   Accepted: 4090 Description When chomping a tree the beaver cuts a very specific shape out o...
分类:其他好文   时间:2014-06-22 17:06:55    阅读次数:233
LeetCode——Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,2,3]. Note: Recursive soluti...
分类:其他好文   时间:2014-06-22 16:37:51    阅读次数:168
hust 1016 Black-White Tree
题目描述在图论中,包含n个结点(结点编号为1~n)、n-1条边的无向连通图被称为树。 在树中,任意一对结点间的简单路径总是惟一的。 你拥有一棵白色的树——所有节点都是白色的。接下来,你需要处理c条指令: 修改指令(0 v):改变一个给定结点的颜色(白变黑,黑变白); 查询指令(1 v):询问从结点1...
分类:其他好文   时间:2014-06-22 12:55:54    阅读次数:213
Leetcode-Sum Root to Leaf Numbers
题目: 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 123. Find...
分类:其他好文   时间:2014-06-22 08:30:24    阅读次数:236
leetcode__Convert Sorted List to Binary Search Tree
Convert Sorted List to Binary Search Tree  Total Accepted: 12283 Total Submissions: 45910My Submissions Given a singly linked list where elements are sorted in ascending order, convert it...
分类:其他好文   时间:2014-06-21 23:57:00    阅读次数:351
【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-06-21 22:44:58    阅读次数:266
HDU 4107 Gangster Segment Tree线段树
这道题也有点新意,就是需要记录最小值段和最大值段,然后成段更新这个段,而不用没点去更新,达到提高速度的目的。 本题过的人很少,因为大部分都超时了,我严格按照线段树的方法去写,一开始居然也超时。 然后修补了两个地方就过了,具体修改的地方请参看程序。 知道最大值段和最小值段,然后修补一下就能过了。不是特别难的题目。 #include #include #include using na...
分类:其他好文   时间:2014-06-21 20:14:04    阅读次数:230
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!