Sorting and Searching
Write a program that takes the student array, generated from the course roster for this course at the time the assignment was created, and sorts the array by first name. The list is provided as a csv file. Read in the file, store it in an array.
Create three separate sorted arrays that are sorted using three different sorting algorithms.
Each method call should count the number of data swaps that occur within the algorithm and output the counts for each algorithm and which sort resulted in the fewest number of swaps. The easiest way to do this would be to create a swap method that is used for all three algorithms and three methods(one for each algorithm) and within each method, everytime the swap method is called, add one to that counter.
You will also need to create a Student class that stores the three values and then store each student in the array.
Once you have sorted the arrays, use any of the sorted arrays to conduct a search, using both sequential search and binary search. You should search for the same value for both searches and count the number of comparisons for each search.
Output a second result that shows the number of comparisons for each search and which resulted in the fewest number of comparisons.
Get Free Quote!
279 Experts Online