Unformatted text preview: , show that it takes at least ( n ) time to nd out whether x appears somewhere in A or not. Give also an O ( n ) algorithm. 3. (a) (5 points) Given an array A [1 ..n ] of positive integers such that for all i , A [ i ] &lt; (log n ) log n : how fast can we sort A ? (b) (15 points) You are given an array of integers, where dierent integers may have dierent number of digits, but the total number of digits over all the integers in the array is n . Show how you can sort this array in O ( n ) time. 4. Given an array A , the task is to nd the largest, 2nd largest, 4th largest, 8th largest, 16th largest ,. ..and so on upto 2 b log n c th largest element. Give an O ( n ) algorithm to do this. 5. Given an array A , the task is to nd b n/k c th largest, b 2 n/k c th largest, b 3 n/k c th largest ,.... and so on upto b kn/k c th largest. Give an O ( n log k ) algorithm. 6. Problem 92 (a),(c) on page 194 (or 225) of CLRS. 1...
View Full Document
This note was uploaded on 10/02/2011 for the course CS 7300 taught by Professor R during the Spring '11 term at LSU.
- Spring '11