This preview shows page 1. Sign up to view the full content.
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
This note was uploaded on 01/28/2012 for the course CSCI 5421 taught by Professor Sturtivant,c during the Fall '08 term at Minnesota.
 Fall '08
 Sturtivant,C
 Algorithms, Data Structures

Click to edit the document details