11 2017 档案
摘要:06-图1 列出连通集(25 分) 给定一个有N个顶点和E条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。输入格式:输入第1行给出2个整数N(0#in...
阅读全文
摘要:05-树9 Huffman Codes(30 分) In 1953, David A. Huffman published his paper “A Method for the Construction of Minimum-Redundancy Code...
阅读全文
摘要:05-树8 File Transfer(25 分) We have a network of computers and a list of bi-directional connections. Each of these connections allo...
阅读全文
摘要:05-树7 堆中的路径(25 分) 将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。输入格式:每组测试第1行包含2个正整数N和M(≤1000),分别是插入元素的个数、以及需要打印的路径条数。下一行给出区间...
阅读全文
摘要:04-树6 Complete Binary Search Tree(30 分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the followin...
阅读全文
摘要: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 ...
阅读全文
摘要:04-树4 是否同一棵二叉搜索树(25 分) 给定一个插入序列就可以唯一确定一棵二叉搜索树。然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到。例如分别按照序列{2, 1, 3}和{2, 3, 1}插入初始为空的二叉搜索树,都得到一样的结果。于是对于输...
阅读全文

浙公网安备 33010602011771号