随笔分类 -  Binary Trees

摘要:根据样例可以明显看出题意。。比较坑的一点注意节点可以是任意字符,不一定是字母,还要判断是否有换行符。 另外空节点要独立判断题目:Problem DUndraw the Trees Input:StandardInputOutput: Standard Output Time Limit: 2 SecondsProfessor Homer has been reported missing. We suspect thathis recent research works might have had something to with this. But we reallydon't 阅读全文
posted @ 2013-12-13 20:08 doubleshik 阅读(222) 评论(0) 推荐(0)
摘要:题目大概意思就是计算一个表达式的值(不知道这道题和书什么关系。。顺序扫一遍就好了)题目:Evaluating Simple C ExpressionsThe task in this problem is to evaluate a sequence of simple C expressions, buy you need not know C to solve the problem! Each of the expressions will appear on a line by itself and will contain no more than 110 characters. T 阅读全文
posted @ 2013-12-13 00:01 doubleshik 阅读(202) 评论(0) 推荐(0)
摘要:题目大意是首先给出一个N , 然后通过读入 括号和数字 建立一棵树, 算出是否有一条路径值和是N 。 有输出yes,否是no做的时候输入有点蛋疼,。 借鉴了网上了他人的代码,非常简洁。。学习了下。。 原地址:http://www.cnblogs.com/xiaocai905767378/archive/2011/11/02/2232750.html题目:Tree SummingBackgroundLISP was one of the earliest high-level programming languages and, with FORTRAN, is one of the oldes 阅读全文
posted @ 2013-11-26 21:14 doubleshik 阅读(159) 评论(0) 推荐(0)
摘要:题意 : 建立一颗树然后计算每一条到叶子节点路径的中值和最小的,输出叶子节点值坑爹一个最后del()多写一个一直RERERE。。题目: TreeYou are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of a path is the sum of values of nodes along that 阅读全文
posted @ 2013-11-25 23:08 doubleshik 阅读(376) 评论(0) 推荐(0)
摘要:题目是说给出一颗满2叉树 。 然后这些节点会下落,找出同一竖直位置叶子值之和。网上看到不用建树的方法比较简便题目:The Falling LeavesEach year, fall in the North Central region is accompanied by the brilliant colors of the leaves on the trees, followed quickly by the falling leaves accumulating under the trees. If the same thing happened to binary trees, h 阅读全文
posted @ 2013-11-23 11:48 doubleshik 阅读(172) 评论(0) 推荐(0)
摘要:做这道题的时候傻X错误百出。。。在计算总和上错了好久。还把=写成了==。。。。蛋疼无比题意就是合并两颗4叉树。 然后按照要求计算值。。主要用了个递归 。 没有像网上其他一些解法用结构指针什么的。。单用了数组题目QuadtreesA quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be split into four quadrants. Each quadrant may again be split 阅读全文
posted @ 2013-11-22 21:36 doubleshik 阅读(509) 评论(0) 推荐(0)