排序
萧瑟1
这个作者很懒,什么都没留下…
展开
-
Aizu - ALDS1_1_A Insertion Sort 插入排序
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:for i = 1 to A.length-1 key = A[i] /* ...原创 2018-08-28 12:01:45 · 331 阅读 · 0 评论 -
Aizu - ALDS1_2_A Bubble Sort 冒泡排序
Write a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:BubbleSort(A)1 for i = 0 to A.length-12 for...原创 2018-08-28 12:18:33 · 186 阅读 · 0 评论 -
Aizu - ALDS1_2_B Selection Sort 选择排序
Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:SelectionSort(A)1 for i = 0 to A.length-12 ...原创 2018-08-28 12:38:37 · 241 阅读 · 0 评论 -
Aizu - ALDS1_2_D Shell Sort 希尔排序
Shell Sort is a generalization of Insertion Sort to arrange a list of nn elements AA .1 insertionSort(A, n, g)2 for i = g to n-13 v = A[i]4 j = i - g5 while j &...原创 2018-08-28 17:36:07 · 382 阅读 · 0 评论 -
Aizu - ALDS1_5_B Merge Sort 归并排序
Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function.Merge(A, left, mid, right) n1 = mid - lef...原创 2018-08-30 10:35:32 · 215 阅读 · 0 评论 -
PAT (Advanced Level) Practice 1146 Topological Order (25 分) 拓扑排序
This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supposed to write a program to test...原创 2018-09-20 22:01:10 · 166 阅读 · 0 评论