23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Design <strong>and</strong> implement a stable version of the bucket-sort algorithm for sort<strong>in</strong>g a<br />

sequence of n elements with <strong>in</strong>teger keys taken from the range [0,N − 1], for N<br />

≥ 2. The algorithm should run <strong>in</strong> O(n + N) time.<br />

P-11.3<br />

Implement merge-sort <strong>and</strong> determ<strong>in</strong>istic quick-sort <strong>and</strong> perform a series of<br />

benchmark<strong>in</strong>g tests to see which one is faster. Your tests should <strong>in</strong>clude<br />

sequences that are "r<strong>and</strong>om" as well as "almost" sorted.<br />

P-11.4<br />

Implement determ<strong>in</strong>istic <strong>and</strong> r<strong>and</strong>omized versions of the quick-sort algorithm<br />

<strong>and</strong> perform a series of benchmark<strong>in</strong>g tests to see which one is faster. Your tests<br />

should <strong>in</strong>clude sequences that are very "r<strong>and</strong>om" look<strong>in</strong>g as well as ones that<br />

are "almost" sorted.<br />

P-11.5<br />

Implement an <strong>in</strong>-place version of <strong>in</strong>sertion-sort <strong>and</strong> an <strong>in</strong>-place version of<br />

quick-sort. Perform benchmark<strong>in</strong>g tests to determ<strong>in</strong>e the range of values of n<br />

where quick-sort is on average better than <strong>in</strong>sertion-sort.<br />

P-11.6<br />

Design <strong>and</strong> implement an animation for one of the sort<strong>in</strong>g algorithms described<br />

<strong>in</strong> this chapter. Your animation should illustrate the key properties of this<br />

algorithm <strong>in</strong> an <strong>in</strong>tuitive manner.<br />

P-11.7<br />

Implement the r<strong>and</strong>omized quick-sort <strong>and</strong> quick-select algorithms, <strong>and</strong> design a<br />

series of experiments to test their relative speeds.<br />

P-11.8<br />

Implement an extended set ADT that <strong>in</strong>cludes the methods union(B),<br />

<strong>in</strong>tersect(B), subtract(B), size(), isEmpty(), plus the methods equals(B),<br />

conta<strong>in</strong>s(e), <strong>in</strong>sert(e), <strong>and</strong> remove(e) with obvious mean<strong>in</strong>g.<br />

P-11.9<br />

Implement the tree-based union/f<strong>in</strong>d partition data structure with both the<br />

union-by-size <strong>and</strong> path-compression heuristics.<br />

Chapter Notes<br />

739

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

Saved successfully!

Ooh no, something went wrong!