
排序
_Gray
这个作者很懒,什么都没留下…
展开
-
1125 Chain the Ropes (25 分)
Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one piece, as shown by the figure. The resulting chai...原创 2019-01-19 11:24:51 · 235 阅读 · 0 评论 -
1089 Insert or Merge (25 分)
According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data,...原创 2019-02-23 13:48:58 · 134 阅读 · 0 评论 -
1101 Quick Sort (25 分)
There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its le...原创 2019-02-21 14:59:27 · 197 阅读 · 0 评论 -
1098 Insertion or Heap Sort (25 分)
According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data,...原创 2019-02-21 14:58:23 · 130 阅读 · 0 评论 -
1067 Sort with Swap(0, i) (25 分)
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 that is allowed to use? For example, to sort {4, 0, 2...原创 2019-01-29 11:12:06 · 112 阅读 · 0 评论 -
1147 Heaps (30 分)
In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater than or equal to (i...原创 2019-01-27 08:39:46 · 211 阅读 · 0 评论 -
1113 Integer Set Partition (25 分)
Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint sets A1 and A2 of n1 and n2 numbers, respectively. Let S1 and S2 denote the sums of a...原创 2019-01-16 00:02:07 · 129 阅读 · 0 评论 -
1109 Group Photo (25 分)
Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following: The number of people in each row must be N/K (round down to the nearest inte...原创 2019-01-14 23:24:51 · 267 阅读 · 0 评论 -
1098 Insertion or Heap Sort (25 分)
According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data,...原创 2019-01-12 15:21:01 · 84 阅读 · 0 评论 -
1137 Final Grading (25 分)
For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from...原创 2019-01-24 18:38:49 · 174 阅读 · 0 评论 -
1153 Decode Registration Card of PAT (25 分)
A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, namely, T for the top level, A for advance and B for basic; the 2nd - 4th digits are the test site nu...原创 2019-02-25 15:30:39 · 129 阅读 · 0 评论