Starting from:

$20

Assignment   5 SOLUTION

The goal of this assignment is provide experience reading data from a file and sorting data using Selection Sort and Merge Sort. This project will inwlve building a simple Lll to evaluate the efficiency of the two sorting algorithms. When debugging your application, I highly recommend that pu start by sorting a small subset of the total entries (e.g., only the first 10 entries). This will allow you to follow a complete run of your sorting algorithms, providing opportunities to spot inconsistencies with respect to expected behavior. 1. [20] Write a Java application which first reads data from the phonebook file here: into an ArrayList of phonebook entries. We'll need to differentiate between the name and phone number when sorting and retrieving data, so each entry should consist of separate fields for the name and phone number (e.g., a class with two private String variables). 2. [20] Implement a method which takes an ArrayList of phonebook entries as an argument and returns a sorted copy of the list using Selection Sort to sort alphabetically by phonebook name. Your implementation should not modify the input list. You should implement yo r own sorting code here, and not simply use built-in Java calls (e.g., in the Arrays and Collections classes). Cite any sources used in the comments of your code. 3. [20] Implement a method which takes an ArrayList of phonebook entries as an argument and returns a sorted copy of the list using Merge Sort to sort alphabetically by phonebook name. Your implementation should not modify the input list. Again, you should implement your own sorting code here, and not simply use built-in Java calls (e.g., in the Arrays and Collections classes. Cite any sources used in the comments of pur code. 4. [20] Implement a method which takes an ArrayList of phonebook entries as an argument and returns true if the input list is sorted alphabetically by phonebook name (false otherwise). use this method to test your sorting implementations. 5. [20] Implement a GUI with at least two buttons:. A button to call pur Selection Sort method from part 2 above and report the elapsed sorting time in the GUI. Clicking this button should report "Erroff if the resulting list is not sorted according to your method from part 4 above. A button to call pur Merge Sort method from part 3 above and report the elapsed 2. sorting time in the GUI. Clicking this button should report "Erroff if the resulting list is not sorted according to your method from part 4 above.

More products