This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Problem A7.2 (C). Let A be a n n integer matrix, and is sorted in the nonincreasing 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 [ n1]. Describe a O ( n ) algorithm that nds max { A [ i ] + A [ i + 1] + + A [ j ] : 0 i j n1 } . Prove the correctness and the time complexity of your algorithm. 1...
View Full
Document
 Winter '07
 YaoyunShi

Click to edit the document details