- 博客(14)
- 收藏
- 关注
原创 04-树6 Complete Binary Search Tree (30分)
04-树6 Complete Binary Search Tree (30分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only
2016-03-28 21:32:45 622
原创 04-树5 Root of AVL Tree (25分)
04-树5 Root of AVL Tree (25分) An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they d
2016-03-28 18:41:31 577
原创 04-树4 是否同一棵二叉搜索树 (25分)
04-树4 是否同一棵二叉搜索树 (25分) 给定一个插入序列就可以唯一确定一棵二叉搜索树。然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到。例如分别按照序列{2, 1, 3}和{2, 3, 1}插入初始为空的二叉搜索树,都得到一样的结果。于是对于输入的各种插入序列,你需要判断它们是否能生成一样的二叉搜索树。 输入格式: 输入包含若干组测试数据。每组数据的第1
2016-03-28 12:58:34 3965
原创 03-树3 Tree Traversals Again (25分)
03-树3 Tree Traversals Again (25分) An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys n
2016-03-27 11:42:28 677
原创 03-树2 List Leaves (25分)
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 Specification: Each input file contains one test case. F
2016-03-27 11:27:47 455
原创 03-树1 树的同构 (25分)
03-树1 树的同构 (25分) 给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。 图1 图2 现给定两棵树,请你判断它们是否是同构的。 输入格式
2016-03-26 23:17:03 6031
原创 02-线性结构3 Pop Sequence (25分)
02-线性结构3 Pop Sequence (25分) Given a stack which can keep MM numbers at most. Push NN numbers in the order of 1, 2, 3, ..., NN and pop randomly. You are supposed to tell if a given seque
2016-03-26 23:03:47 492
原创 02-线性结构2 Reversing Linked List (25分)
02-线性结构2 Reversing Linked List (25分) Given a constant KK and a singly linked list LL, you are supposed to reverse the links of every KK elements on LL. For example, given LL being 1
2016-03-26 17:09:04 3676
原创 02-线性结构1 一元多项式的乘法与加法运算 (20分)
02-线性结构1 一元多项式的乘法与加法运算 (20分) 设计函数分别求两个一元多项式的乘积与和。 输入格式: 输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。 输出格式: 输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空
2016-03-26 16:51:46 2116
原创 01-复杂度2 Maximum Subsequence Sum (25分)
01-复杂度2 Maximum Subsequence Sum (25分) Given a sequence of KK integers { N1N1, N2N2, ..., NKNK }. A continuous subsequence is defined to be { NiNi, Ni1Ni+1, ..., NjNj
2016-03-26 16:47:37 5335 1
原创 01-复杂度1 最大子列和问题 (20分)
01-复杂度1 最大子列和问题 (20分) 给定KK个整数组成的序列{ N1N1, N2N2, ..., NKNK },“连续子列”被定义为{ NiNi, Ni1Ni+1, ..., NjNj },其中 1ijK1≤i≤j≤K。“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5
2016-03-26 16:37:47 4818
原创 1013. Battle Over Cities (25)
1013. Battle Over Cities (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue It is vitally important to have all the
2016-03-04 19:40:03 381
原创 1012. The Best Rank (25)
1012. The Best Rank (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To evaluate the performance of our first yea
2016-03-04 14:34:05 411
原创 1010. Radix (25)
时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a pair of positive integers, for example, 6 and 110, can this equation
2016-03-04 09:40:20 325
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人