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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

274 Chap. 7 Internal Sorting7.13 Graph f 1 (n) = n log n, f 2 (n) = n 1.5 , <strong>and</strong> f 3 (n) = n 2 in the range 1 ≤ n ≤1000 <strong>to</strong> visually compare their growth rates. Typically, the constant fac<strong>to</strong>rin the running-time expression for an implementation of Insertion Sort willbe less than the constant fac<strong>to</strong>rs for Shellsort or Quicksort. How many timesgreater can the constant fac<strong>to</strong>r be for Shellsort <strong>to</strong> be faster than Insertion Sortwhen n = 1000? How many times greater can the constant fac<strong>to</strong>r be forQuicksort <strong>to</strong> be faster than Insertion Sort when n = 1000?7.14 Imagine that there exists an algorithm SPLITk that can split a list L of nelements in<strong>to</strong> k sublists, each containing one or more elements, such thatsublist i contains only elements whose values are less than all elements insublist j for i < j 1) {SPLITk(L, sub); // SPLITk places sublists in<strong>to</strong> subfor (i=0; i

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

Saved successfully!

Ooh no, something went wrong!