摘要: 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 阅读全文
posted @ 2018-10-17 00:40 shenqingping 阅读(105) 评论(0) 推荐(0)
摘要: 图1 图2 现给定两棵树,请你判断它们是否是同构的。 输入格式: 输入给出2棵二叉树树的信息。对于每棵树,首先在一行中给出一个非负整数N (≤10),即该树的结点数(此时假设结点从0到N−1编号);随后N行,第i行对应编号第i个结点,给出该结点中存储的1个英文大写字母、其左孩子结点的编号、右孩子结点 阅读全文
posted @ 2018-10-16 21:56 shenqingping 阅读(391) 评论(0) 推荐(0)
摘要: Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given s 阅读全文
posted @ 2018-10-16 11:43 shenqingping 阅读(248) 评论(0) 推荐(0)
摘要: Given a constant K and a singly linked list L, you are supposed to reverse the links of every Kelements on L. For example, given L being 1→2→3→4→5→6, 阅读全文
posted @ 2018-10-15 12:25 shenqingping 阅读(159) 评论(0) 推荐(0)
摘要: 设计函数分别求两个一元多项式的乘积与和。 输入格式: 输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。 输出格式: 输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空 阅读全文
posted @ 2018-10-12 17:19 shenqingping 阅读(158) 评论(0) 推荐(0)