Name:
A. O(lg(n)) < O(n) < O(n*lg(n)) < O(2n) < O(n2)
B. O(n) < O(lg(n)) < O(n*lg(n)) < O(2n) < O(n2)
C. O(lg(n)) < O(n) < O(n*lg(n)) < O(n2) < O(2n)
D. O(n) < O(lg(n)) < O(n*lg(n)) < O(n2) < O(2n)
A. Insertion sort and mergesort
B. Quicksort and heap sort
C. Insertion sort and quicksort
D. Heap sort and mergesort
A. n2 leaves. B. 2n nodes C. n! nodes. D. n! leaves.
A. to determine the median of 5 elements.
B. to determine the k-th smallest element in an array for given array and k.
C. To choose a "Comparator" function to use on the median problem.
D. to determine the ripest apple in a barrel.
A. Quicksort B. Heap sort
C. Mergesort D. None of the above
A. 2n lg(n) B. n2/2 C. n2 D. 2n2
A. It rearranges the array somewhat.
B. It leaves the array in sorted order.
C. It uses a "partition" function to divide the array exactly in half if the array size is even and into two segments whose sizes differ by one if the array size is odd.
D. It uses about n lg(n) array element comparisons.
A. Provably, any algorithm that solves the problem must use at least n-1 comparisons.
B. There is an algorithm which uses only n-1 element comparisons.
C. Both A and B
D. Neither A nor B
A. Provably, any algorithm that solves the problem must use at least 2n - 3 comparisons
B. Provably, any algorithm that solves the problem must use at least about 3n/2 comparisons.
C. Provably, any algorithm that solves the problem must use at least about n + lg(n) comparisons.
D. Provably, any algorithm that solves the problem must use at least about n * lg(n) comparisons.
A. There is an algorithm that uses about 2n - 3 comparisons
B. There is an algorithm that uses about about 3n/2 comparisons.
C. There is an algorithm that uses O(n) comparisons.
D. All of the above.
A. randomizedSelect has the fewer comparisons in practice (average/expected number of comparisons).
B. randomizedSelect has the better worst case number of comparisons.
C. Both A and B
D. Neither A nor B
A. Has an expected case number of comparisons E(n) which is O(n).
E. Has a worst case number of comparisons W(n) which is O(n*lg(n)).
C. Both A and B
D. Neither A nor B
A. to select the k-th largest of an array of characters.
B. to find approximations to a pattern in a text
C. to support dynamic dictionary operations.
D. None of the above
A. both Boyer-Moore and Knuth-Morris-Pratt algorithms require no more than O(nm) comparisons.
B. Knuth-Morris-Pratt can use as few as about n/m comparisions in special cases.
C. Both A and B
D. Neither A nor B
A. The data is fixed and many look-ups (searches) are to be done.
B. When there is insufficient real memory for the array.
C. When the data is dynamic, with many insertions/deletions of items as well as look-ups.
D. The records have a "color" field.
A. between 1 and 16
B. between 4 and 16
C. between 16 and 256
D. between 256 and 4096
A. no two red edges in a row from root to leaf
B. all leaves have same black depth
C. no node has two red children
D. the root node is black
A. the colors of a black node and it's two red children are flipped.
B. the colors of a red node and it's two black children are flipped.
C. a temporary situation in which a red node has a red child is fixed.
D. a temporary situation in which a black node has a black child is fixed.
A. the colors of a black node and it's two red children are flipped.
B. the colors of a red node and it's two black children are flipped.
C. a temporary situation in which a red node has a red child is fixed.
D. a temporary situation in which a black node has a black child is fixed.
A. 1 B. 2 C. 4 D. 16
A. 2 B. 4 C. 5 D. 10
A. O(1) B. O(lg(n)) C. O(n1/2) D. O(n*lg(n))
A. O(1) B. O(lg(n)) C. O(n1/2) D. O(n*lg(n))
A. O(1) B. O(lg(n)) C. O(n1/2) D. O(n*lg(n))
A. finding max and min in an unordered array.
B. merge sort.
C. Both A and B
D. Neither A nor B
A. Insertion sort
B. quick sort
C. Both A and B
D. Neither A nor B
| v 123456789 123456789 123456789 123456789 123456789 123456789 12345 Text: no analog of asymptotic complexity exists in research on bananas. Pattern: bananaThe initial comparison sequence fails after "ana" at the right of the pattern has matched and " " fails to match "n" in position 3.
__________________ What is the next position of the pattern on the basis of the char-table heuristic?
__________________ What is the next position of the pattern on the basis of the match-table heuristic?
__________________ Which of the two choices will the Boyer-Moore algorithm use?
__________________ How many character comparisions will Boyer-Moore require to find this pattern in this text? Answer accurate to within plus/minus 10 comparisions is accepted.
void heapSort(A, n) { constructHeap(A, n); for (int i = n, i > 1; --i) { swap(A[1], A[i]); fixHeap(A, i-1); } }A. Write a recursion relation or summation formula expressing the worst case number of comparisons used by the heapSort function above.
B. What is the worst case number of comparisions used by heapSort on an array of size n?