上一页 1 ··· 58 59 60 61 62 63 64 65 66 ··· 90 下一页
摘要: 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-04-20 13:10 王清河 阅读(233) 评论(0) 推荐(0)
摘要: 将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。 输入格式: 每组测试第1行包含2个正整数N和M(≤),分别是插入元素的个数、以及需要打印的路径条数。下一行给出区间[-10000, 10000]内的N个要被插入一个初始为空的小顶堆的整数。最后一行 阅读全文
posted @ 2019-04-18 10:57 王清河 阅读(334) 评论(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-04-15 08:59 王清河 阅读(1149) 评论(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-04-12 18:21 王清河 阅读(202) 评论(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-04-08 12:17 王清河 阅读(284) 评论(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-04-07 15:53 王清河 阅读(378) 评论(0) 推荐(0)
摘要: 给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。 图1 图2 现给定两棵树,请你判断它们是否是同构的。 输入格式: 输入给出2棵 阅读全文
posted @ 2019-04-06 13:11 王清河 阅读(188) 评论(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-04-03 18:42 王清河 阅读(992) 评论(0) 推荐(0)
摘要: 本题要求实现给定二叉搜索树的5种常用操作。 函数接口定义: 其中BinTree结构定义如下: 函数Insert将X插入二叉搜索树BST并返回结果树的根结点指针; 函数Delete将X从二叉搜索树BST中删除,并返回结果树的根结点指针;如果X不在树中,则打印一行Not Found并返回原树的根结点指针 阅读全文
posted @ 2019-03-30 16:10 王清河 阅读(819) 评论(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-03-22 18:26 王清河 阅读(152) 评论(0) 推荐(0)
上一页 1 ··· 58 59 60 61 62 63 64 65 66 ··· 90 下一页