Question: Write a java program that reads a series of input lines and sorts them into alphabetical order, ignoring the case of words. The program should

Write a java program that reads a series of input lines and sorts them into alphabetical order, ignoring the case of words.

The program should use the merge sort algorithm so that it efficiently sorts even a large file.

To start your program, download the file here: SortNamesTest.java

Data files with names available here: names.txt, names2.txt

[Optional] Performance check of your merge implementation using

System.currentTimeMillis()

Compare the runtime with Arrays.sort

Files:

// Program to sort an input file of names, ignoring case, using the mergesort // algorithm. import java.io.*; import java.util.*; public class SortNamesTest { public static void main (String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("names.txt")); String[] names = readNames(input); mergeSort(names); } // complete readNames implementation to read names from the file public static String[] readNames(Scanner input) { } // complete merge sort implementation public static void mergeSort(String[] array) { } }

names.txt

Slater, Kendall Lavery, Ryan Chandler, Arabella "Babe" Chandler, Stuart Kane, Erica Chandler, Adam Jr Slater, Zach Montgomery, Jackson

names2.txt

Colton Sherman Aryanna Foster Marcus Dougherty Finley Nixon Jaylee Bauer Angie Sanders Livia Monroe Salma Watts Tara Mason Daphne Krueger Sloane Nelson Giana Mathews Caitlyn Weaver Gerardo Wells Carina Sellers Dixie Calhoun Abby Carson Iliana Lindsey Quinten Foster Rene Ray Damari Norman Leanna Hess

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!