12.07.2015 Views

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

514 Chap. 15 Lower Boundsbetter than sorting the list. Is this true for the second biggest value? For the medianvalue? In later sections we will examine those questions. For this section, wewill continue our examination of lower bounds proofs by reconsidering the simpleproblem of finding the maximum value in an unsorted list. Lower bounds on otherselection problems will be covered in later sections of this chapter.Here is a simple algorithm for finding the largest value.// Return position of largest value in "A"static int largest(int[] A) {int currlarge = 0; // Holds largest element positionfor (int i=1; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!