Java
CSCI-2467 Lab 14 – Sorting Algorithms
Background
Download the starter project Lab14.zip. Unzip the file with 7zip using “Extract Here”. Open the Lab14 project with IntelliJ. The project contains two data files containing serialized String arrays containing surnames (from the census data set).
surnames.ser – contains 100 surnames
bigsurnames.ser – contains 25,000 surnames
Assignment
Implement a Bubble Sort for sorting arrays of Strings.
Modify the Main method to first call your Bubble Sort sort method and then call Java’s built-in sort. Make sure that your Bubble Sort is working properly. When you run the program, it will compare the run times of your Bubble Sort and the Java sort algorithm using the list of 100 surnames.
Once you are convinced the program is working, change the program to use the larger dataset. Run the program and compare the run times of the two algorithms.
Once you’ve completed the program, answer the following questions. Zip your project and submit your zipped project for grading and this Word document with your answers:
- For a list of 100 surnames, how many milliseconds did a Bubble Sort take?
- For a list of 100 surnames, how many milliseconds did a Java’s Sort take?
- For a list of 25,000 surnames, how many milliseconds did a Bubble Sort take?
- For a list of 25,000 surnames, how many milliseconds did a Java’s Sort take?
- Which algorithm is more efficient?