摘要: 03-树2 List Leaves(25 分)Given a tree, you are supposed to list all the leaves in the order of top down, and left to right.Input Specifi... 阅读全文
posted @ 2018-05-01 21:54 focus5679 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 03-树1 树的同构(25 分)给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。图1图2现给定两... 阅读全文
posted @ 2018-05-01 19:47 focus5679 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 02-线性结构4 Pop Sequence(25 分)Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop rand... 阅读全文
posted @ 2018-05-01 14:43 focus5679 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 02-线性结构1 两个有序链表序列的合并(15 分)本题要求实现一个函数,将两个链表表示的递增整数序列合并为一个非递减的整数序列。函数接口定义:List Merge( List L1, List L2 );其中List结构定义如下:typedef struct Nod... 阅读全文
posted @ 2018-05-01 13:32 focus5679 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 01-复杂度3 二分查找(20 分)本题要求实现二分查找算法。函数接口定义:Position BinarySearch( List L, ElementType X );其中List结构定义如下:typedef int Position;typedef struct ... 阅读全文
posted @ 2018-05-01 13:28 focus5679 阅读(311) 评论(0) 推荐(0) 编辑
摘要: 02-线性结构2 一元多项式的乘法与加法运算(20 分)设计函数分别求两个一元多项式的乘积与和。输入格式:输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:输出分... 阅读全文
posted @ 2018-05-01 13:28 focus5679 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 01-复杂度2 Maximum Subsequence Sum(25 分)Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined ... 阅读全文
posted @ 2018-05-01 13:26 focus5679 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 01-复杂度1 最大子列和问题(20 分)给定K个整数组成的序列{ N​1​​, N​2​​, ..., N​K​​ },“连续子列”被定义为{ N​i​​, N​i+1​​, ..., N​j​​ },其中 1≤i≤j≤K。“最大子列和”则被定义为所有连续子列元素的... 阅读全文
posted @ 2018-05-01 13:25 focus5679 阅读(123) 评论(0) 推荐(0) 编辑