2003-Analysis_of_Algorithms-scanned

2003-Analysis_of_Algorithms-scanned - Comprehensive Exam:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Comprehensive Exam: Algorithms and Concrete Mat hematics Autumn 2003 1. [lo pts] Prove a tight asymptotic bound on the behavior of T(71) = T(n/3) +T(n/9) + n3, where T(n) 5 b for n < no, where no and b are some given constants. For simplicity, solve for n being a power of 9. Simplest approach is to guess T(n) = Q(n3) and prove by induction. First notice that T(n) = fl(n3) just by examining the recurrence. Now assume T(n) 5 en3 for some constant c. This constant should be large enough to satisfy initial conditions. Naw the inductive step is: The claim follows since the expression in the parenthesis is smaller than 1 for large enough C. 2. [lo pts] Given integers a1 , az, . . . , a,, give a randomized algorithm that outputs all pairs (i, j) such that ai = aj. Your algorithm should have expected running time O(n+ K) where K is the number of pairs output. Prove the upper bound on the running time. Use hashing with chaining, with size of the hash table constant factor larger than n. Moreover, construct each chain as a chain of linked lists, each list holding equal elements. In other words, if aj hashes into position q, look through the linked list and find the list that corresponds to the value of aj. Then, for each element ak of this list, output (aj, ah). The claim follows since the expected number of lists attached to a single hash cell is constant. 3. [lo pts] Assume that you are given a 'Lbla~k box" implementation of a comparisons- based data structure that supports "extract minimum" and "insert element". You are
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

2003-Analysis_of_Algorithms-scanned - Comprehensive Exam:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online