码迷,mamicode.com
首页 >  
搜索关键字:leaves    ( 277个结果
LeetCode "Find Leaves of Binary Tree"
Typical DFS problem. Simply get higher height and push_back. ...
分类:其他好文   时间:2016-06-27 12:04:56    阅读次数:123
[LeetCode] Find Leaves of Binary Tree 找二叉树的叶节点
Given a binary tree, find all leaves and then remove those leaves. Then repeat the previous steps until the tree is empty. Example: Given binary tree ...
分类:其他好文   时间:2016-06-25 13:36:30    阅读次数:133
1004. Counting Leaves (30)
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file contain ...
分类:其他好文   时间:2016-06-08 12:03:23    阅读次数:230
PAT (Advanced Level) 1004. Counting Leaves (30)
简单DFS。 ...
分类:其他好文   时间:2016-05-15 21:36:37    阅读次数:225
层次性结构
(define (append a b) (if (null? a) b (cons (car a) (append (cdr a) (cons (car a) b))))) (define nil (list)) (define (count-leaves x) (cond ((null? x) 0) ((not (pair? x)) 1)...
分类:其他好文   时间:2016-05-12 22:53:59    阅读次数:265
What Are You Talking About
Description Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now...
分类:其他好文   时间:2016-05-07 09:36:31    阅读次数:140
UVA 699 The Falling Leaves
。。。。。。。 刘汝佳的:
分类:其他好文   时间:2016-03-16 22:15:17    阅读次数:370
uva 699 the falling leaves——yhx
因为复制过来排版很乱,所以上截图。 利用先序的特性可以递归处理。
分类:其他好文   时间:2016-03-13 14:12:16    阅读次数:224
Educational Codeforces Round 7 E. Ants in Leaves(DFS+贪心)
题目链接:点击打开链接 题意:给出一棵n个结点的树, 每个叶子结点上有一只蚂蚁, 每秒每只蚂蚁可以向相邻结点走一步, 同一时刻同一结点上只能有最多一只蚂蚁(根结点除外),根结点为1, 求所有蚂蚁都移动到1上的最小花费时间。 思路:很容易想到,采取贪心的思路就行了, 那么只要不断向上走就行了, 因为根结点比较特殊, 我们只考虑它的子树, 对于它的每一棵子树, 先dfs处理出所有结点的深度,然后对...
分类:其他好文   时间:2016-02-13 15:48:09    阅读次数:193
[2016-02-09][UVA][699][The Falling Leaves]
[2016-02-09][UVA][699][The Falling Leaves]时间:2016-02-09 13:29:10 星期二题目编号:UVA 699题目大意: 给一棵树,每棵树有一个叶子,叶子的值是点权,求叶子垂直落下后,(同一个方向的形成一堆),求每堆叶子的总权值位置的描述:每个左子树...
分类:其他好文   时间:2016-02-09 15:52:11    阅读次数:333
277条   上一页 1 ... 19 20 21 22 23 ... 28 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!