203w07hw7 - Problem A7.2(C Let A be a n × n integer matrix...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
EECS 203, Discrete Mathematics Winter 2007, University of Michigan, Ann Arbor Problem Set 7 Problems from the Textbook 3.1 34[E], 56[E] 3.2 12[E], 20[E], 18[M] 3.3 10[E] (you can use a calculator, express your result in terms of years and days (1 year = 365 days) if it’s more than a day) * Additional Problems Required for All Students Problem A7.1 (M). Describe an algorithm that finds the k ’th largest number from an input of n num- bers. Prove that your algorithm is correct. State and prove the worse-case number of comparisons of your algorithm. You will get the full score for a correct answer those complexity (in the number of comparisons) is O ( n log k ). A 20% extra credit (or penalty) applies if the complexity of your algorithm is better (or worse).
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Problem A7.2 (C). Let A be a n × n integer matrix, and is sorted in the non-increasing order within each row and each column. Let x be an integer. Describe an algorithm that makes O ( n ) comparisons to decide if x appears in A . Prove the correctness and the time complexity of your algorithm. * Extra Credit Problem A7.3. Let A be an array of n integers A [0], A [1], ··· , A [ n-1]. Describe a O ( n ) algorithm that finds max { A [ i ] + A [ i + 1] + ··· + A [ j ] : 0 ≤ i ≤ j ≤ n-1 } . Prove the correctness and the time complexity of your algorithm. 1...
View Full Document

Ask a homework question - tutors are online