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.

Sec. 3.1 <strong>Introduction</strong> 61Example 3.3 Consider the following code:sum = 0;for (i=1; i 10, the algorithm with cost T(n) = 2n 2 is slower than the algorithmwith cost T(n) = 20n. This graph also shows that the equation T(n) = 5n log ngrows somewhat more quickly than both T(n) = 10n <strong>and</strong> T(n) = 20n, but notnearly so quickly as the equation T(n) = 2n 2 . For constants a, b > 1, n a growsfaster than either log b n or log n b . Finally, algorithms with cost T(n) = 2 n orT(n) = n! are prohibitively expensive for even modest values of n. Note that forconstants a, b ≥ 1, a n grows faster than n b .

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

Saved successfully!

Ooh no, something went wrong!