- 博客(8)
- 收藏
- 关注
原创 树的遍历——后序遍历的非递归算法
算法思路 后序遍历的非递归算法。思路参考来自这里。思路是当当前结点没有左孩子或右孩子或左孩子和右孩子已经被访问的情况下,访问该结点。 具体思路如下:当前结点左子树不为空且左孩子和右孩子没有被访问过的情况下,不断入栈左子树; 左子树访问结束,判断当前结点是否有右孩子且右孩子没有访问过的情况下,入栈右孩子,回到步骤1; 当最后一个右孩子被访问到时,开始出栈,并记录上一次 范围...
2018-09-19 23:51:22 17780 3
原创 1006 Sign In and Sign Out (25)
目录题目:解题思路:C语言实现:题目:1006 Sign In and Sign Out (25)(25 分)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out w...
2018-08-03 15:15:58 179
原创 1005 Spell It Right (20)
目录题目:解题思路:C语言实现:题目:1005 Spell It Right (20)(20 分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Inpu...
2018-08-03 15:06:12 183
原创 1002 A+B for Polynomials (25)
目录题目:解题思路:C语言实现:题目:1002 A+B for Polynomials (25)(25 分)This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case o...
2018-08-03 14:58:41 175
原创 1001 A+B Format (20)
目录题目:解题思路:C语言实现题目:1001 A+B Format (20)(20 分)Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are ...
2018-08-03 14:40:31 138
原创 1007 Maximum Subsequence Sum (25)
目录题目:解题思路:C语言实现:题目:1007 Maximum Subsequence Sum (25)(25 分)Given a sequence of K integers { N~1~, N~2~, ..., N~K~ }. A continuous subsequence is defined to be { N~i~, N~i+1~, ..., N~j~ } wh...
2018-08-02 18:59:52 117
原创 1008 Elevator (20)
目录题目:解题思路:C语言实现:题目:1008 Elevator (20)(20 分)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the...
2018-08-02 18:44:24 143
原创 1009 Product of Polynomials (25)
目录题目:解题思路:C语言实现:题目:1009 Product of Polynomials (25)(25 分)This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test...
2018-08-02 18:30:18 172
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人