Assignment 5 Solution

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