随笔分类 -  浙大数据结构习题集

摘要:二叉搜索树的操作集 本题要求实现给定二叉搜索树的5种常用操作。 函数接口定义: BinTree Insert( BinTree BST, ElementType X ); BinTree Delete( BinTree BST, ElementType X ); Position Find( Bin 阅读全文
posted @ 2021-05-26 21:55 onlyblues 阅读(245) 评论(0) 推荐(0) 编辑
摘要:两个有序链表序列的合并 本题要求实现一个函数,将两个链表表示的递增整数序列合并为一个非递减的整数序列。 函数接口定义: List Merge( List L1, List L2 ); 其中 List 结构定义如下: typedef struct Node *PtrToNode; struct Nod 阅读全文
posted @ 2021-05-26 21:51 onlyblues 阅读(404) 评论(0) 推荐(0) 编辑
摘要:二分查找 本题要求实现二分查找算法。 函数接口定义: Position BinarySearch( List L, ElementType X ); 其中 List 结构定义如下: typedef int Position; typedef struct LNode *List; struct LN 阅读全文
posted @ 2021-05-26 21:47 onlyblues 阅读(400) 评论(0) 推荐(0) 编辑
摘要:Hashing - Hard Version Given a hash table of size N, we can define a hash function H(x)=x%N. Suppose that the linear probing is used to solve collisio 阅读全文
posted @ 2021-05-25 14:48 onlyblues 阅读(548) 评论(0) 推荐(0) 编辑
摘要:Sort with Swap(0, i) Given any permutation of the numbers {0, 1, 2,..., N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is t 阅读全文
posted @ 2021-05-24 17:43 onlyblues 阅读(170) 评论(0) 推荐(0) 编辑
摘要:Insert or Merge According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each i 阅读全文
posted @ 2021-05-05 08:24 onlyblues 阅读(116) 评论(0) 推荐(0) 编辑
摘要:六度空间 “六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图1所示。 图1 六度空间示意图 “六度空间”理论虽然得到广泛的认 阅读全文
posted @ 2021-04-14 17:05 onlyblues 阅读(1538) 评论(0) 推荐(1) 编辑
摘要:Saving James Bond - Hard Version This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous 阅读全文
posted @ 2021-04-13 19:14 onlyblues 阅读(206) 评论(0) 推荐(1) 编辑
摘要:Saving James Bond - Easy Version This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous 阅读全文
posted @ 2021-04-10 19:05 onlyblues 阅读(129) 评论(0) 推荐(0) 编辑
摘要:Huffman Codes In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Redundancy Codes", and hence printed his name in 阅读全文
posted @ 2021-04-08 07:51 onlyblues 阅读(258) 评论(0) 推荐(0) 编辑
摘要:File Transfer We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one compu 阅读全文
posted @ 2021-04-05 13:07 onlyblues 阅读(362) 评论(0) 推荐(0) 编辑
摘要:是否同一棵二叉搜索树 给定一个插入序列就可以唯一确定一棵二叉搜索树。然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到。例如分别按照序列{2, 1, 3}和{2, 3, 1}插入初始为空的二叉搜索树,都得到一样的结果。于是对于输入的各种插入序列,你需要判断它们是否能生成一样的二叉搜索树。 输入 阅读全文
posted @ 2021-03-30 12:32 onlyblues 阅读(448) 评论(0) 推荐(0) 编辑
摘要:Complete Binary Search Tree A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of 阅读全文
posted @ 2021-03-28 09:45 onlyblues 阅读(227) 评论(0) 推荐(0) 编辑
摘要:Pop Sequence 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 阅读全文
posted @ 2021-03-26 14:12 onlyblues 阅读(168) 评论(0) 推荐(0) 编辑
摘要:List Leaves 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 co 阅读全文
posted @ 2021-03-26 08:18 onlyblues 阅读(113) 评论(0) 推荐(0) 编辑
摘要:Tree Traversals Again An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node 阅读全文
posted @ 2021-03-25 19:00 onlyblues 阅读(165) 评论(0) 推荐(0) 编辑
摘要:Reversing Linked List Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, give 阅读全文
posted @ 2021-03-17 14:23 onlyblues 阅读(301) 评论(0) 推荐(0) 编辑
摘要:一元多项式的乘法与加法运算 设计函数分别求两个一元多项式的乘积与和。 输入格式: 输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。 输出格式: 输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非 阅读全文
posted @ 2021-03-14 21:01 onlyblues 阅读(2962) 评论(1) 推荐(1) 编辑

Web Analytics
点击右上角即可分享
微信分享提示