Unformatted text preview: CSci 5421: Practice Questions for Midterm 1 1. Solve the following recurrences using the Master Theorem (MT), if it is applicable, and show your work. If the MT is not applicable, then state clearly why this is so. Assume throughout that T (1) = 1 and that n is a power of 4, 8, and 2, in recurrences (i), (ii), and (iii), respectively. (i) T ( n ) = 4 T ( n/ 4) + √ n log n (ii) T ( n ) = 2 T ( n/ 8) + √ n (iii) T ( n ) = 2 T ( n/ 2) + n/ log n 2. Let A [1 ..n ] be an array storing n distinct integers sorted in increasing order. (Some of the integers could be negative.) Give a divideandconquer algorithm to decide if there is an index k such that A [ k ] = k . The output should be “true” if such an index exists, and “false” otherwise. The worstcase running time should be Θ(log n ). Your answer should include: (a) a short description of the main ideas, from which the correctness of your approach should be evident, (b) pseudocode, and (c) an analysis of the running time....
View
Full Document
 Fall '08
 Sturtivant,C
 Algorithms, Dynamic Programming, Data Structures, total number, optimal binary search, short description

Click to edit the document details