随笔分类 -  浙大mooc网数据结构

浙大mooc网数据结构课后习题
摘要:In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Redundancy Codes", and hence printed his name in the history o 阅读全文
posted @ 2019-11-02 19:54 王清河 阅读(186) 评论(0) 推荐(0) 编辑
摘要:We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another 阅读全文
posted @ 2019-10-29 21:39 王清河 阅读(247) 评论(0) 推荐(0) 编辑
摘要:将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。 输入格式: 每组测试第1行包含2个正整数N和M(≤),分别是插入元素的个数、以及需要打印的路径条数。下一行给出区间[-10000, 10000]内的N个要被插入一个初始为空的小顶堆的整数。最后一行 阅读全文
posted @ 2019-10-27 20:06 王清河 阅读(128) 评论(0) 推荐(0) 编辑
摘要: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 nodes 阅读全文
posted @ 2019-10-27 20:04 王清河 阅读(127) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-10-27 20:03 王清河 阅读(154) 评论(0) 推荐(0) 编辑
摘要:给定一个插入序列就可以唯一确定一棵二叉搜索树。然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到。例如分别按照序列{2, 1, 3}和{2, 3, 1}插入初始为空的二叉搜索树,都得到一样的结果。于是对于输入的各种插入序列,你需要判断它们是否能生成一样的二叉搜索树。 输入格式: 输入包含若干组 阅读全文
posted @ 2019-10-27 20:01 王清河 阅读(171) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-10-24 23:13 王清河 阅读(145) 评论(0) 推荐(0) 编辑
摘要: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 @ 2019-10-23 22:29 王清河 阅读(172) 评论(0) 推荐(0) 编辑
摘要:给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。 图1 图2 现给定两棵树,请你判断它们是否是同构的。 输入格式: 输入给出2棵 阅读全文
posted @ 2019-10-22 22:32 王清河 阅读(196) 评论(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 @ 2019-10-21 22:10 王清河 阅读(145) 评论(0) 推荐(0) 编辑
摘要: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, given L being 1→2→3→4→5→6, 阅读全文
posted @ 2019-10-20 21:01 王清河 阅读(282) 评论(0) 推荐(0) 编辑
摘要:设计函数分别求两个一元多项式的乘积与和。 输入格式: 输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。 输出格式: 输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空 阅读全文
posted @ 2019-10-19 22:14 王清河 阅读(170) 评论(0) 推荐(0) 编辑
摘要: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​​ } where 1. The Max 阅读全文
posted @ 2019-10-16 21:49 王清河 阅读(207) 评论(0) 推荐(0) 编辑
摘要:给定K个整数组成的序列{ N​1​​, N​2​​, ..., N​K​​ },“连续子列”被定义为{ N​i​​, N​i+1​​, ..., N​j​​ },其中 1。“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5, -2 },其连续子 阅读全文
posted @ 2019-10-16 19:32 王清河 阅读(281) 评论(0) 推荐(0) 编辑
摘要:本题要求实现给定二叉搜索树的5种常用操作。 函数接口定义: 其中BinTree结构定义如下: 函数Insert将X插入二叉搜索树BST并返回结果树的根结点指针; 函数Delete将X从二叉搜索树BST中删除,并返回结果树的根结点指针;如果X不在树中,则打印一行Not Found并返回原树的根结点指针 阅读全文
posted @ 2019-10-15 22:08 王清河 阅读(367) 评论(0) 推荐(0) 编辑
摘要:本题要求实现一个函数,将两个链表表示的递增整数序列合并为一个非递减的整数序列。 函数接口定义: 其中List结构定义如下: L1和L2是给定的带头结点的单链表,其结点存储的数据是递增有序的;函数Merge要将L1和L2合并为一个非递减的整数序列。应直接使用原序列中的结点,返回归并后的带头结点的链表头 阅读全文
posted @ 2019-10-14 22:37 王清河 阅读(328) 评论(0) 推荐(0) 编辑
摘要:本题要求实现二分查找算法。 函数接口定义: 其中List结构定义如下: L是用户传入的一个线性表,其中ElementType元素可以通过>、=、<进行比较,并且题目保证传入的数据是递增有序的。函数BinarySearch要查找X在Data中的位置,即数组下标(注意:元素从下标1开始存储)。找到则返回 阅读全文
posted @ 2019-10-14 20:37 王清河 阅读(281) 评论(0) 推荐(0) 编辑
摘要:给定两个由英文字母组成的字符串 String 和 Pattern,要求找到 Pattern 在 String 中第一次出现的位置,并将此位置后的 String 的子串输出。如果找不到,则输出“Not Found”。 本题旨在测试各种不同的匹配算法在各种数据情况下的表现。各组测试数据特点如下: 数据0 阅读全文
posted @ 2019-05-29 21:25 王清河 阅读(1261) 评论(0) 推荐(0) 编辑
摘要:Given a hash table of size N, we can define a hash function (. Suppose that the linear probing is used to solve collisions, we can easily obtain the s 阅读全文
posted @ 2019-05-29 21:22 王清河 阅读(505) 评论(0) 推荐(0) 编辑
摘要:实现QQ新帐户申请和老帐户登陆的简化版功能。最大挑战是:据说现在的QQ号码已经有10位数了。 输入格式: 输入首先给出一个正整数N(≤),随后给出N行指令。每行指令的格式为:“命令符(空格)QQ号码(空格)密码”。其中命令符为“N”(代表New)时表示要新申请一个QQ号,后面是新帐户的号码和密码;命 阅读全文
posted @ 2019-05-29 21:11 王清河 阅读(453) 评论(0) 推荐(0) 编辑

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