Question: 6) Which is the best sorting algorithm if all the items can not fit in main memory? A) selection sort B) insertion sort C) mergesort
6) Which is the best sorting algorithm if all the items can not fit in main memory?
A) selection sort
B) insertion sort
C) mergesort
D) quicksort
E) radix sort
7) What is the best case running time for insertion sort?
A) O(1)
B) O(log10 N)
C) O(log2 N)
D) O(log2 N)
E) O(N)
F) O(N log N)
G) O(N2)
H) O(N3)
I) O(Nk)
J) O(2N)
K) O(N!)
8) Examine the steps of the following algorithm and write the name of the algorithm described in the blank provided:
For each position from the beginning of an array to its end, find the least item in the remainder of the array (excluding the current position and all positions occurring before it in the array) and place it in the current position.
A) insertion sort
B) selection sort
C) shell sort
D) merge sort
E) quicksort
F) radix sort
9) Which sorting algorithm sorts items without comparing them?
A) selection sort
B) insertion sort
C) mergesort
D) quicksort
E) radix sort
F) Trick question - items cannot be sorted unless they are compared.
10) In the quicksort algorithm, why is the insertion sort algorithm used when the list becomes small?
A) Quicksort will not work on arbitrarily small lists.
B) Insertion sort is more efficient when the list is small.
C) Using insertion sort ensures a stable sort.
D) It is impossible to write quicksort without using insertion sort.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
