Quiz 2
Quiz 2
NAME *
Q1 For linear search, the "best case scenario" (when the algorithm
completes with the fewest number of steps) is when:*
The first item equals the key
The middle item equals the key
The data does not contain the key
The last item equals the key
Q14 An array has indices ranging from x to x+n; the merge sort
would be applied from c to x+n, where c*
Is the remainder of x/2, if x is an odd number
Is the non-integer part of x/2
Is the integer part of x/2
Is an integer chosen arbitrarily, so long that it is smaller than x+n
Q18 How many passes (or "scans") will there be through a list
being sorted using a selection sort?*
Array_size*2
Array_size+1
Array_size-1
None of the above
Q19 Bubble sorting got its name from a Bubble gum company that
used it for the first time.*
True
False
Q20 Which one of the following is the first step in a selection sort
algorithm?*
The minimum value in the list is found.
The maximum value in the list is found.
Adjacent elements are swapped.
opposite elements are swapped.
Q21 What are the correct intermediate steps of the following data
set when it is being sorted with the bubble sort? 15,20,10,18*
15,10,20,18 -- 15,10,18,20 -- 10,15,18,20
10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20
15,20,10,18 -- 15,10,20,18 -- 10,15,20,18 -- 10,15,18,20
15,18,10,20 -- 10,18,15,20 -- 10,15,18,20 -- 10,15,18,20
Q22 What is the max number of comparisons that can take place
when a bubble sort is implemented? Assume there are n elements in
the array?*
(1/2)(n-1)
(1/2)n(n-1)
Option 3
None of the above
(1/4)n(n-1)
*
θ (n2)
θ (nlogn)
θ (n1.5)
θ (n)
Q30 Which of the following sorting algorithm has the running time
that is least dependent on the initial ordering of the input?*
Insertion sort
Quick sort
Merge sort
Selection sort
Submit
Clear form