The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998

18.04.2013 Views

Implementation Challenges Next: Breaking Problems Down Up: Data Structures and Sorting Previous: Exercises Implementation Challenges 1. Implement versions of several different dictionary data structures, such as linked lists, binary trees, balanced binary search trees, and hash tables. Conduct experiments to assess the relative performance of these data structures in a simple application that reads a large text file and reports exactly one instance of each word that appears within it. This application can be efficiently implemented by maintaining a dictionary of all distinct words that have appeared thus far in the text and inserting/reporting each word that is not found. Write a brief report with your conclusions. 2. Implement versions of several different sorting algorithms, such as selection sort, insertion sort, heapsort, mergesort, and quicksort. Conduct experiments to assess the relative performance of these algorithms in a simple application that reads a large text file and reports exactly one instance of each word that appears within it. This application can be efficiently implemented by sorting all the words that occur in the text and then passing through the sorted sequence to identify one instance of each distinct word. Write a brief report with your conclusions. Algorithms Mon Jun 2 23:33:50 EDT 1997 file:///E|/BOOK/BOOK/NODE41.HTM [19/1/2003 1:37:08]

Implementation Challenges Next: Graph Algorithms Up: Breaking Problems Down Previous: Exercises Implementation Challenges 1. (*) Many types of products sold appeal more to members of one ethnic group than another. Perhaps Greeks eat more pasta per capita than Russians do, while Japanese find baseball more appealing than do Italians. A market researcher might be interested in having a program scan the names on a mailing list to select the ones most likely to be, say, Greek to target for a given mailing. Develop a program that makes reasonable mappings between pairs of first/ last names and ethnicities. One approach would be to compute the edit distance between query names and a family of names of known ethnicity. Feel free to experiment with other approaches. 2. (*) In the game of Battleship, the first player hides a collection of, say, three ships on a grid. The second player guesses a series of grid positions and is informed whether they hit or miss a battleship. The second player continues to query until each of the battleship positions has been probed. While the second player must succeed after making 100 different probes, we seek a strategy to use as few probes as possible to achieve the goal. Develop a program that tries to efficiently sink all the battleships. One reasonable algorithmic approach would be based on divide-and-conquer or binary search. 3. (*) A Caesar shift (see Section ) is a very simple class of ciphers for secret messages. Unfortunately, they can be broken using statistical properties of English. Develop a program capable of decrypting Caesar shifts of sufficiently long texts. Algorithms Mon Jun 2 23:33:50 EDT 1997 file:///E|/BOOK/BOOK2/NODE58.HTM [19/1/2003 1:37:09]

Implementation Challenges<br />

Next: Breaking Problems Down Up: Data Structures and Sorting Previous: Exercises<br />

Implementation Challenges<br />

1. Implement versions of several different dictionary data structures, such as linked lists, binary<br />

trees, balanced binary search trees, and hash tables. Conduct experiments to assess the relative<br />

performance of these data structures in a simple application that reads a large text file and reports<br />

exactly one instance of each word that appears within it. This application can be efficiently<br />

implemented by maintaining a dictionary of all distinct words that have appeared thus far in the<br />

text and inserting/reporting each word that is not found. Write a brief report with your<br />

conclusions.<br />

2. Implement versions of several different sorting algorithms, such as selection sort, insertion sort,<br />

heapsort, mergesort, and quicksort. Conduct experiments to assess the relative performance of<br />

these algorithms in a simple application that reads a large text file and reports exactly one instance<br />

of each word that appears within it. This application can be efficiently implemented by sorting all<br />

the words that occur in the text and then passing through the sorted sequence to identify one<br />

instance of each distinct word. Write a brief report with your conclusions.<br />

<strong>Algorithm</strong>s<br />

Mon Jun 2 23:33:50 EDT 1997<br />

file:///E|/BOOK/BOOK/NODE41.HTM [19/1/2003 1:37:08]

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

Saved successfully!

Ooh no, something went wrong!