随笔分类 -  Data_Structure of ZJU in MOOC

摘要:实现QQ新帐户申请和老帐户登陆的简化版功能。最大挑战是:据说现在的QQ号码已经有10位数了。 输入格式: 输入首先给出一个正整数N(≤),随后给出N行指令。每行指令的格式为:“命令符(空格)QQ号码(空格)密码”。其中命令符为“N”(代表New)时表示要新申请一个QQ号,后面是新帐户的号码和密码;命 阅读全文
posted @ 2019-06-08 15:33 Acoccus 阅读(491) 评论(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-06-06 11:34 Acoccus 阅读(187) 评论(0) 推荐(0)
摘要: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 the ONLY operation tha 阅读全文
posted @ 2019-06-02 09:45 Acoccus 阅读(186) 评论(0) 推荐(1)
摘要:The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist 阅读全文
posted @ 2019-05-31 23:26 Acoccus 阅读(180) 评论(0) 推荐(0)
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文
posted @ 2019-05-31 21:11 Acoccus 阅读(158) 评论(0) 推荐(0)
摘要:欢迎评论(指正或是询问都可),谢谢大家 一、判断题 思路很正常的题目。 1-4反例:4个顶点只用3条边就可以做到全连通。所以边数可能等于顶点个数减一。错误。 二、选择题 2-8需要细心的做一下双旋操作, 2-12 C 设数字 {4371, 1323, 6173, 4199, 4344, 9679, 阅读全文
posted @ 2019-05-31 19:18 Acoccus 阅读(2680) 评论(0) 推荐(0)
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文
posted @ 2019-05-31 08:10 Acoccus 阅读(207) 评论(0) 推荐(0)
摘要:10-5 10-6 11-1 11-2 11-3 11-4 KMP 阅读全文
posted @ 2019-05-28 10:48 Acoccus 阅读(105) 评论(0) 推荐(0)
摘要:给定公司N名员工的工龄,要求按工龄增序输出每个工龄段有多少员工。 输入格式: 输入首先给出正整数N(≤),即员工总人数;随后给出N个整数,即每个员工的工龄,范围在[0, 50]。 输出格式: 按工龄的递增顺序输出每个工龄的员工个数,格式为:“工龄:人数”。每项占一行。如果人数为0则不输出该项。 输入 阅读全文
posted @ 2019-05-28 10:40 Acoccus 阅读(168) 评论(0) 推荐(0)
摘要:排序算法大汇总,缺少基数排序,需要自己再写一遍 1 #include <cstdio> 2 #include <stdlib.h> 3 #include <algorithm> 4 using namespace std; 5 const int CUTOFF = 50; 6 7 typedef i 阅读全文
posted @ 2019-05-28 10:38 Acoccus 阅读(237) 评论(0) 推荐(0)
摘要:假定一个工程项目由一组子任务构成,子任务之间有的可以并行执行,有的必须在完成了其它一些子任务后才能执行。“任务调度”包括一组子任务、以及每个子任务可以执行所依赖的子任务集。 比如完成一个专业的所有课程学习和毕业设计可以看成一个本科生要完成的一项工程,各门课程可以看成是子任务。有些课程可以同时开设,比 阅读全文
posted @ 2019-05-28 10:37 Acoccus 阅读(191) 评论(0) 推荐(0)
摘要:1 /* 图的邻接矩阵表示法 */ 2 #include 3 #include 4 5 #define MaxVertexNum 1001 /* 最大顶点数设为100 */ 6 #define INFINITY 65535 /* ∞设为双字节无符号整数的最大值65535*/ 7 #define ERROR -1 8 typedef int... 阅读全文
posted @ 2019-05-28 10:36 Acoccus 阅读(431) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #define MaxVertexNum 102 5 #define INFINITY 65536 6 using namespace std; 7 8 typedef int Vertex; 9 typedef int WeightType; ... 阅读全文
posted @ 2019-05-28 10:36 Acoccus 阅读(264) 评论(0) 推荐(0)
摘要:1 #include <cstdio> 2 #include <stdlib.h> 3 const int INFINITY = 65536; 4 const int MaxVertexNum = 501; 5 const int ERROR = -1; 6 int dist[MaxVertexNu 阅读全文
posted @ 2019-05-28 10:35 Acoccus 阅读(257) 评论(0) 推荐(0)
摘要:This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of d 阅读全文
posted @ 2019-05-28 10:30 Acoccus 阅读(249) 评论(0) 推荐(0)
摘要:This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of d 阅读全文
posted @ 2019-05-28 10:28 Acoccus 阅读(211) 评论(0) 推荐(0)
摘要:给定一个有N个顶点和E条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。 输入格式: 输入第1行给出2个整数N(0)和E,分别是图的顶点数和边数。随后E行,每行给出一条边的两个端点。每行中的数字 阅读全文
posted @ 2019-05-28 10:27 Acoccus 阅读(128) 评论(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-05-28 10:24 Acoccus 阅读(172) 评论(0) 推荐(0)
摘要:给定一个插入序列就可以唯一确定一棵二叉搜索树。然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到。例如分别按照序列{2, 1, 3}和{2, 3, 1}插入初始为空的二叉搜索树,都得到一样的结果。于是对于输入的各种插入序列,你需要判断它们是否能生成一样的二叉搜索树。 输入格式: 输入包含若干组 阅读全文
posted @ 2019-05-28 10:23 Acoccus 阅读(167) 评论(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-05-28 10:22 Acoccus 阅读(142) 评论(0) 推荐(0)