Exam 11: Sorting
Exam 1: P A C++ Primer25 Questions
Exam 2: Introduction to Software Design24 Questions
Exam 3: Program Correctness and Efficiency25 Questions
Exam 4: Inheritance and Class Hierarchies25 Questions
Exam 5: Sequential Containers25 Questions
Exam 6: Stacks24 Questions
Exam 7: Queues and Deques25 Questions
Exam 8: Recursion25 Questions
Exam 9: Trees25 Questions
Exam 10: Sets and Maps25 Questions
Exam 11: Sorting25 Questions
Exam 12: Self-Balancing Search Trees25 Questions
Exam 13: Graphs25 Questions
Exam 14: Advanced C++ Topics, and Overview of UML25 Questions
Select questions type
If the array happens to be sorted before selection sort begins, no exchanges will be required.
Free
(True/False)
4.7/5
(43)
Correct Answer:
True
A(n) __________ sort compares adjacent array elements and exchanges their values if they are out of order.
Free
(Short Answer)
4.8/5
(36)
Correct Answer:
bubble
The total effort to reconstruct a sorted array through merging is O(__________).
Free
(Multiple Choice)
4.9/5
(24)
Correct Answer:
C
In the best case scenario for insertion sort, the maximum number of comparisons is O(__________).
(Short Answer)
4.9/5
(41)
When comparing selection sort, bubble sort, and insertion sort, we can observe that __________ sort gives the best performance for most arrays, because it takes advantage of any partial sorting that is in the array and uses less costly shifts instead of exchanges to rearrange array elements.
(Short Answer)
4.8/5
(35)
Suppose the growth rate of a sorting routine is O(n log n). If the sorting routine is applied to an array with 1,024 items, we can expect it to perform about __________ operations.
(Multiple Choice)
4.9/5
(40)
The time and space requirements for a single merge operation are each O(__________)
(Multiple Choice)
4.8/5
(40)
The merge sort algorithm requires, at least temporarily, n log n extra storage locations.
(True/False)
4.8/5
(42)
A max heap is a data structure that maintains the largest value at the top.
(True/False)
4.9/5
(37)
The __________ sort is a quadratic sorting algorithm based on the technique used by card players to arrange a hand of cards.
(Short Answer)
4.8/5
(44)
If the pivot used by quicksort is always the first element of an input array, the worst possible performance occurs when the input array is sorted.
(True/False)
4.9/5
(34)
The error written into KW::insert function below can be corrected with the code __________.


(Multiple Choice)
4.8/5
(32)
In the best case scenario of quicksort, the partitioning process at each level involves moving every element into its correct partition, so quicksort is O(__________).
(Multiple Choice)
4.7/5
(38)
Because we have n items to insert and each insert (or remove) is O(log n), building a heap is O(__________).
(Short Answer)
4.9/5
(41)
The process by which quicksort rearranges an array into two parts around a pivot is called __________.
(Short Answer)
4.8/5
(39)
For a node at position p in a heap, the right child is at __________.
(Multiple Choice)
4.9/5
(42)
In the worst case scenario, the number of comparisons performed by a bubble sort is O(__________).
(Multiple Choice)
5.0/5
(31)
__________ is the process of rearranging the data in an array or container so that the data elements are in increasing (or decreasing) order.
(Short Answer)
4.8/5
(32)
If the pivot value generated by quicksort is a random value selected from the current sequence, then statistically it is expected that one-quarter of the items in the sequence will be less than the pivot value and three-quarters will be greater than the pivot value.
(True/False)
4.8/5
(43)
In a selection sort, there are at most __________ exchanges.
(Multiple Choice)
4.9/5
(36)
Showing 1 - 20 of 25
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)