Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Roster below:

image text in transcribed

1 Aaberg Ti tjaaber 2 Dorang Ryan rdorang 3 Garapati Satya spgarap 4 Johansen Kaleigh ksjohan 5 Kennedy Dayna dakenn2 6 Leoni James jwleoni 7 Licking Makenna mmlicki 8 Lohmar Jack jclohm1 9 Martinez Alexandro amart64 10 Mennel Michaela mhmenne 11 Miranda Richard rmirand 12 Mozdzen Konrad kcmozdz 13 Pecoraro Andrew ampeco1 14 Sanders Christine crsand2 15 Schmidt Scott sschmi2 Rachel rnunger 16 Unger 1 Aaberg Ti tjaaber 2 Dorang Ryan rdorang 3 Garapati Satya spgarap 4 Johansen Kaleigh ksjohan 5 Kennedy Dayna dakenn2 6 Leoni James jwleoni 7 Licking Makenna mmlicki 8 Lohmar Jack jclohm1 9 Martinez Alexandro amart64 10 Mennel Michaela mhmenne 11 Miranda Richard rmirand 12 Mozdzen Konrad kcmozdz 13 Pecoraro Andrew ampeco1 14 Sanders Christine crsand2 15 Schmidt Scott sschmi2 Rachel rnunger 16 Unger

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

7. Senior management supports the career system.

Answered: 1 week ago