Sorting Review
Scroll through the page to review your answers. The correct answer is
highlighted in
green.
Your incorrect answers (if any) are highlighted in
red.
If you'd like to take the test over again, click the reset button at the end of the test.
Consider the following consecutive configurations of a list while it it being
sorted:
- (4, 5, 3, 1)
- (4, 5, 3, 1)
- (4, 3, 5, 1)
- (4, 3, 1, 5)
What sorting algorithm is being used?
Which of the following is a proper heap?
For merge sort to merge the following two arrays: (1, 4, 5, 8) and (3, 7, 9,
13), what comparisons have to take place?
Consider the intermediate configurations of an array being sorted below. What
sort is being used?
- (4, 5, 2, 1, 7)
- (1, 5, 2, 4, 7)
- (1, 2, 5, 4, 7)
The intermediate configurations below are characteristic of which sorting
algorithm?
- (5, 1, 4, 8, 2)
- (1, 5, 4, 8, 2)
- (1, 4, 5, 8, 2)
- (1, 4, 5, 2, 8)
Imagine the following specification of a comparison function. If the two
numbers passed in have an equal number of digits, they are equal. Otherwise,
the one with the larger number of digits is greater. Which of the following
lists are sorted with respect to this comparison function?
Consider the following intermediate configurations of a list being sorted. What
sorting algorithm is being used?
- (5, 2, 8, 1, 9)
- (1, 5, 2, 8, 9)
- (1, 2, 5, 8, 9)