< Free Open Study > |
Bubble sort
Selection sort
Insertion sort
4950
99
O(N^{2})
O(N)
O(N^{2})
O(Nlog_{2}N)
O(N)
O(Nlog_{2}N)
The correct answer is (c).
The correct answer is (d).
QuickSort would take the longest; InsertionSort and ShortBubble would take the shortest.
A bubble sort is O(N) if the values are already sorted, and if the algorithm stops processing when the sorting is complete (e.g., ShortBubble).
None.
QuickSort is O(N^{2}) if the values are already sorted and the split algorithm causes the array to be split into one element and the rest of the array.
True.
False. HeapSort is better for nearly sorted data than QuickSort is.
True
Only (b) is true.
Programmer time refers to the amount of time it takes a programmer to generate a piece of software, including the time to design, code, and test it. If a programmer needs to finish a software project quickly, sometimes his or her time is a more critical efficiency consideration than how fast the resulting program runs on a computer. In this chapter, recursive sorting algorithms are cited as time-savers for the programmer, possibly at the expense of computing time.
The correct answer is (b).
All of the algorithms are stable except HeapSort.
Declare an array indexed from 0 through 99. Use the slots in the array as counters for that percentile score-that is, the slot indexed by 0 is the counter for percentile scores of 0; the slot indexed by 2 is the counter for percentile scores of 2; and so on. To produce the required output, go through the array from 99 down to 0, printing the loop counter as many times as values appear in that slot.
HeapSort
QuickSort or InsertionSort
QuickSort
MergeSort
For the best case, O(N)
For the worst case, O(N)
For the best case, O(1)
For the worst case, O(N^{2})
50
50
50
The correct answer is (a).
To sort the file in descending order, collect the queues from Queues [9] down to Queues [0].
No. Simply substituting the Stack ADT for the Queue ADT would not work. The elements would be gathered in the wrong order.
< Free Open Study > |
Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |