摘要: Given the relations of all the activities of a project, you are supposed to find the earliest completion time of the project. Input Specification: Eac 阅读全文
posted @ 2018-11-18 18:09 shenqingping 阅读(230) 评论(0) 推荐(0)
摘要: “六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图1所示。 “六度空间”理论虽然得到广泛的认同,并且正在得到越来越多的应用。 阅读全文
posted @ 2018-11-09 11:27 shenqingping 阅读(242) 评论(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 @ 2018-11-06 09:53 shenqingping 阅读(137) 评论(0) 推荐(0)
摘要: 给定一个有N个顶点和E条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。 输入格式: 输入第1行给出2个整数N(0)和E,分别是图的顶点数和边数。随后E行,每行给出一条边的两个端点。每行中的数字 阅读全文
posted @ 2018-11-03 11:28 shenqingping 阅读(125) 评论(0) 推荐(0)
摘要: Figure 1 Input Specification: Each input file contains one test case. For each case, the first line contains a positive integer N (≤30) which is the t 阅读全文
posted @ 2018-10-31 00:43 shenqingping 阅读(151) 评论(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 @ 2018-10-24 22:49 shenqingping 阅读(221) 评论(0) 推荐(0)
摘要: 将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。 输入格式: 每组测试第1行包含2个正整数N和M(≤),分别是插入元素的个数、以及需要打印的路径条数。下一行给出区间[-10000, 10000]内的N个要被插入一个初始为空的小顶堆的整数。最后一行 阅读全文
posted @ 2018-10-24 16:12 shenqingping 阅读(194) 评论(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 @ 2018-10-24 15:58 shenqingping 阅读(174) 评论(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 @ 2018-10-19 22:39 shenqingping 阅读(150) 评论(0) 推荐(0)
摘要: 给定一个插入序列就可以唯一确定一棵二叉搜索树。然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到。例如分别按照序列{2, 1, 3}和{2, 3, 1}插入初始为空的二叉搜索树,都得到一样的结果。于是对于输入的各种插入序列,你需要判断它们是否能生成一样的二叉搜索树。 输入格式: 输入包含若干组 阅读全文
posted @ 2018-10-19 12:07 shenqingping 阅读(151) 评论(0) 推荐(0)