r c letter 71 90 A 54 80 B 39 70 C 26 60 D
Name: Answer key
Multiple choice problems (2 points each)
C. O(lg(n)) < O(n) < O(n*lg(n)) < O(n2) < O(2n)
D. Heap sort and mergesort
B. to determine the k-th smallest element in an array for given array and k.
D. None of the above
B. n2/2
A. It rearranges the array somewhat.
C. Both A and B.
C. Provably, any algorithm that solves the problem must use at least about n + lg(n) comparisons.
D. All of the above.
A. randomizedSelect has the fewer comparisons in practice (average/expected number of comparisons).
A. Has an expected case number of comparisons E(n) which is O(n).
D. None of the above
A. both Boyer-Moore and Knuth-Morris-Pratt algorithms require no more than O(nm) comparisons.
C. When the data is dynamic, with many insertions/deletions of items as well as look-ups.
C. between 16 and 256
C. no node has two red children
A. the colors of a black node and it's two red children are flipped.
C. a temporary situation in which a red node has a red child is fixed.
B. 2
D. 10
B. O(lg(n))
B. O(lg(n))
B. O(lg(n))
D. Neither A nor B
A. Insertion sort