External sorting data structures and algorithms -Chapter10- - Exercises

Multiple Choice

1, all the sorting method in () are not stable sorting method.
A. B. Hill sort bubble sort D. C. direct insertion sort merge sort

2, 1000 is provided with an element of disorder, it is desirable to pick out the fastest among the top 10 largest element, the best choice () method.
A. Quick Sort Bubble Sort B. C. D. radix sort heap sort

3, the sequence of elements to be sorted in the order of the basic premise of the method is the most efficient sorting ().
A. Selection Sort Insertion Sort B. C. D. Quick sort merge sort

4, a group of records sorted code (46, 79, 56, 38, 40, 84), using the method of establishing the initial heap stack to sort ().
84,79,56,38,40,46 79,46,56,38,40,80 B. A.
C. D. 84,79,56,46,40,38 84,56,79,40,46 38

5, a group of records sorted code (46, 79, 56, 38, 40, 84), the method using the quick sort, to record a first reference time division result is obtained ().
40,38,46,79,56,84 38,40,46,56,79,84 B. A.
C. D. 40,38,46,56,79,84 40,38,46,84,56 79

6, a group of records sorted code (25,48,16,35,79,82,23,40,36,72) containing an ordered length 5 of Table 2, the merge sort method according to the the results after merging trip sequence is ().
16,25,35,48,79,82,23,36,40,72 16,25,35,48,23,40,79,82,36,72 B. A.
C. 16,25,48, 35,79,82,23,36,40,72 D. 16,25,35,48,79,23,36,40,72,82

7, the sorting methods, never removed sequentially ordered sequence elements in the sorted sequence (initially empty) comparing the elements, put it in the correct position on the method of the sorted sequence, known as ().
A. B. Hill sort bubble sort insertion sort D. C. Selection Sort

8, the sorting methods, never ordered sequence of elements selected, and sequentially placed in the sorted sequence method (initially empty) one end, known as ().
A. B. Hill sort merge sort C. D. Selection Sort Insertion Sort

9, when sorting the linear table (25,84,21,47,15,27,68,35,20) by a method of some sort, the change elements of the sequence as follows:
⑴ 25,84,21,47,15 , 27,68,35,20 20,15,21,25,47,27,68,35,84 ⑵
⑶ ⑷ 15,20,21 15,20,21,25,35,27,47,68,84 , 25,27,35,47,68,84,
sorting method is used is ().
A. Select sort merge sort B. C. D. Hill sort quick sort

10, several ordering methods described below, rather than sorting method is based on the comparison ().
A. Selection Sort Insertion Sort B. C. D. radix sort Quick sort

11, several sorting method described below, the maximum amount of memory required is ().
A. Selection Sort Insertion Sort B. C. D. Quick sort merge sort

12, quickly sorting method in () most circumstances not conducive to play its strengths.
Data size too large to be sorted A. B. To sort contains a plurality of the same value
the number of data to be sorted C. D. basically ordered to be sorted is an odd number

13, the n different sort Bubble sort codes, most often in the comparator () case.
A. ascending order descending order B. C. D. elements of a basic element of disorder and orderly

14, the n different sort Bubble sort codes, the number of comparisons is disordered when the element ().
A. n + 1 B. n C. n -1 D. n (n-1) / 2

15, quickly sorting method in (C) case most conducive to play its strengths.
A. sorted data code containing a plurality of the same sort
of data to be sorted B. basically ordered
C. data to be sorted completely disordered
D. sorted by differences between the maximum and minimum data

16, the five different sort of data, at least compared () times.
A. 4 B. 5 C. 6 D. 7

17, the five different data sorted, require up to compare () times.
A. 8 B. 9 C. 10 D. 25

18, the following key sequence () heap.
94,23,31,72,16,53 16,72,31,23,94,53 B. A.
C. D. 16,53,23,94,31,72 16,23,53,31,94 72

19, is a heap () to sort.
A. Insert C. B. Select exchange merge D.

20, the shape of the stack is a ().
A. binary sort full binary tree B. C. D. balanced binary tree complete binary tree

Fill in the blank

1, when a set of records for direct insertion sort {54,38,96,23,15,72,60,45,83}, when the record 60 is inserted into the seventh ordered list, to be compared (3 ) times.

The maximum depth of 2, when using a quick sort method set quickly sort records {54,38,96,23,15,72,60,45,83}, use recursive call stack is achievable (4 ), totaling the number of recursive calls to (5), which is the second recursive call) after a set of records (first division quickly sort.

3, heap sort, quick sort and merge sort, if only from the storage space considerations, should first select (heap sort) method, followed by selection (quicksort) method, and finally selecting (merge sort) method; if only the sort the results of stability considerations, should be selected (merge) method; if only the worst case ordering from fastest to save memory and consideration should select (heap sort) method.

4, method refers to stable sort (sorted, the order of recording the same keyword do not change).

5, the insertion sort, Shell sort, selection sort, quick sort, heap sort, merge sort, and radix sort average comparison is the minimum number of sorting (radix sort), the required memory capacity is up to (merge sort).

6, the quick sort and heap sort, when the original recording or close to the positive-sequence reverse order, the selection (heap sort), if the original records disorder, it is the best choice (quicksort).

7, the insertion and selection sort, if the initial data basically in order, the selection (insertion sort); If the initial data base in reverse order, the selection (selection sort).

8, when a sequence of n element is the bubble sort, the minimum number of comparisons (n-1).

9, a merge sort n records for collection, the average time required is (nlogn).

10, for a set of n recording bubble sort is performed, in the worst case the time required is (O (n2)).

11, for a set of n recording merge sort is performed, additional space is required (O (n)).

12, for a set n th record sort quickly, the time required in the worst case (O (n2)).

13. To set up the sequence {Q, H, C, Y, P, A, M, S, R, D, F, X} key rearranged in ascending alphabetical order, the bubble sort is the result of a trip ({H, C, Q, P, a, M, S, R, D, F, X, Y}); initial steps of 4 Hill trip result is sorted ({P, a, C, S, Q, D, F, X, R, H, M, Y}); two-way merge is the result of a trip ({H, Q, C, Y, a, P, M, S, D, R, F, X}); trip result of quicksort ({F, H, C, D, P, a, M, Q, R, S, Y, X}); heap sort result of the initial stack is ( {A, D, C, R, F, Q, M, S, Y, P, H, X}).

14, most of the sorting algorithm has two basic operating :( comparison) and (exchange).

Short answer

1, for a given key string {503,087,512,061,908,170,897,275,653,462}, are written in the direct insertion sort, Shell sort, bubble sort, quicksort, direct selection sort, heap sort, merge sort, and radix sort result of the operation of each trip data.

2, there are n different English words, is equal to their length, are m, if n >> 50, m <5, complexity ask what time-optimal ordering method? why?

Published 393 original articles · won praise 651 · views 50000 +

Guess you like

Origin blog.csdn.net/weixin_43896318/article/details/104092872