Chapter 7 (Sorting) Flashcards
In a lower bound simple sort, how many swaps does it take to sort?
The number of inversions that are present
T/F Radix sort sorts by each digit, least significant first
T
What is sorting in main memory called?
Interal sorting
In a bucket sort, initialize the array to all ____
Zeroes
What does the running time of a shell sort depend on?
The increment sequence
Name this sort: Comparing and swapping distant elements at first, and the distance decreases as the algorithm runs, until the last phase when adjacent elements are compared
Shell sort
What approach does quick sort use?
Divide and conquer
What is the running time of a Radix sort?
O(N)
What is a shell sort sometimes called?
Diminishing sequence sort or diminishing increment sort
What is the running time of a deleteMin in a heap sort?
O(log N)
How do you a fix a descending order list in a heap sort?
Build a maxheap instead of a minheap
What is the running time of the shell sorts Hibbard’s sequence?
Theta (N^(3/2))
T/F In Multiway Merge, if there are k tapes to merge, then the largest value across the k tapes must be found
F, smallest value
How is a list sorted using a merge sort?
Recursively split into 2 smaller lists which are sorted
What might large sets of data require utilizing?
Tape or disk
What can give you an efficiency improvement in a quick sort?
Median-of-3
What is a 1-sort the same as?
Insertion sort
What is it called when data requires tape or disk?
External sorting
In a bucket sort, you should start with an array size of ____
M
T/F In a bucket sort, input consists of integer values less than M
T
Any algorithm for sorting that uses only comparisons requires ____ comparisons (and hence time) in the worst case
Ω(N log N)
What is one drawback of a multiway merge?
In a k-way merge, 2k tapes are needed
What is the final step of a shell sort?
1-sort
What is the running time of the shell sorts Sedgewick sequence?
O(N^(4/3))
T/F Elements in 0 through p-1 in an insertion sort are known to be sorted
T