06 2020 档案
摘要:1105 Spiral Matrix (25分) This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix
阅读全文
摘要:1104 Sum of Number Segments (20分) Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the s
阅读全文
摘要:1026 Table Tennis (30分) A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if the
阅读全文
摘要:1091 Acute Stroke (30分) One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in
阅读全文
摘要:1095 Cars on Campus (30分) Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers
阅读全文
摘要:1098 Insertion or Heap Sort (25分) According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted o
阅读全文
摘要:记录一下自己理解的堆和堆排序吧。 堆是一种类似于完全二叉树的树形结构,对于二叉树中所有非叶子节点,如果根节点的值严格大于其两个儿子的值,则称为 大顶堆,反之称为小顶堆。 堆排序的一般步骤: 首先利用已有的数据构造一个堆,大顶堆增序,小顶堆降序。 将堆顶的元素与堆末元素交换,接着重新调整剩下的元素为一
阅读全文
摘要:1089 Insert or Merge (25分) According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output l
阅读全文
摘要:1088 Rational Arithmetic (20分) For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference,
阅读全文
摘要:1086 Tree Traversals Again (25分) An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that wh
阅读全文
摘要:1080 Graduate Admission (30分) It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Prov
阅读全文
摘要:1078 Hashing (25分) The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of
阅读全文
摘要:1074 Reversing Linked List (25分) Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For ex
阅读全文
摘要:1099 Build A Binary Search Tree (30分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left
阅读全文
摘要:1068 Find More Coins (30分) Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a univer
阅读全文
摘要:1064 Complete Binary Search Tree (30分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left
阅读全文
摘要:1066 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 of any node diff
阅读全文
摘要:1065 A+B and C (64bit) (20分) Given three integers A, B and C in [−], you are supposed to tell whether A+B>C. Input Specification: The first line of th
阅读全文
摘要:1057 Stack (30分) Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operatio
阅读全文

浙公网安备 33010602011771号