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. In ...
分类:
其他好文 时间:
2018-04-06 11:03:25
阅读次数:
164
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. Input Specification: Each input file contains one t ...
分类:
其他好文 时间:
2018-04-04 20:45:01
阅读次数:
181
中国大学MOOC-陈越、何钦铭-数据结构-2018春 第三讲课后习题第二题 ...
分类:
其他好文 时间:
2018-03-26 19:07:24
阅读次数:
153
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 ...
分类:
其他好文 时间:
2018-03-10 14:17:08
阅读次数:
187
Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. 实现一个数据结构:字典树(前 ...
分类:
其他好文 时间:
2018-03-07 11:44:08
阅读次数:
183
思路: 1. 先建树 比如利用 vector<vector<int>> v; v[node].size() 即为叶子的判别条件 2. 利用bfs逐层判断节点是否为叶子节点,若是则level数组对应的位置加一 3. 求出深度并打印 ...
分类:
其他好文 时间:
2018-02-27 19:34:26
阅读次数:
170
[抄题]: [暴力解法]: 时间分析: 空间分析: [思维问题]: [一句话思路]: [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入): [画图]: [一刷]: [二刷]: [三刷]: [四刷]: [五刷]: [五分钟肉眼debug的结果]: [总结]: ...
分类:
其他好文 时间:
2018-02-18 17:05:16
阅读次数:
184
UVa 699 The Falling Leaves(递归建树) 假设一棵二叉树也会落叶 而且叶子只会垂直下落 每个节点保存的值为那个节点上的叶子数 求所有叶子全部下落后 地面从左到右每堆有多少片叶子 和UVa 839 -- Not so Mobile(树的递归输入)有点像 都是递归输入的 一个节点 ...
分类:
其他好文 时间:
2018-02-15 17:53:24
阅读次数:
248
求所有左节点的和。 你说你是不是傻,一个人对你好不好,不能只听他说什么,要看做什么,可是哦,连说都不说的时候,就是真的不在意了。 换位思考,我不会像TA这样。话说,记得顺手下个单买个东西,说一句太晚了回去路上注意安全是很容易被忘记的事情么? 兴致勃勃给我讲组会的笑话,这些破事情我真的不太在意的,和我 ...
分类:
其他好文 时间:
2018-01-25 23:05:44
阅读次数:
190