Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code the following in java according to the specifications. Write a complete program, to collect statistics on a series of sorts The main program

Please code the following in java according to the specifications.

Write a complete program, to collect statistics on a series of sorts

The main program will continue the following until the end of the set of data.

  1. Call a method to read in a group of numbers to be sorted.
  2. Call 3 methods (or put into 1 if you wish) to sort these values using 3 different sorts.
  3. Call a method to compare the 3 sorts.

Step 1: The read method will first read a heading describing the group of numbers (ie: - the heading maybe 10 numbers in order, 50 numbers in random order or 100 numbers in reverse order). Then it will read in a group of numbers. The original group should be printed out as it is read in.

Step 2: The three sorts should all receive the data in their original order before sorting.

  1. One sort will be an inefficient one like the Bubble sort
  2. The second sort should be an efficient sort like the Quicksort
  3. The 3rd sort can be any one of your choice

After each individual sort finishes the sorted array should be printed. You should add code and then print for each sort the number of comparisons and/or interchanges that each of the 3 sorts required. You can use global variables to track these counts.

You can then compare the 3 types of sorts to see for each set which did the best most efficient job.

Remember that each group of data must start with a heading describing what it is testing. You are allowed to have repeats in the group but there should not be too many repeated values. You should include at least the following 9 groups (the heading for a group can be what I use to describe it).

Data to be used:

  1. 10 numbers in almost sorted order (a few out of order)
  2. 10 numbers in random order
  3. 10 numbers in reverse order (a few out of order)
  4. 30 numbers in almost sorted order (a few out of order)
  5. 30 numbers in random order
  6. 30 numbers in reverse order (a few out of order)
  7. 50 numbers in almost sorted order (a few out of order)
  8. 50 numbers in random order
  9. 50 numbers in reverse order (or almost reverse)

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

1. Identify someone from work who deserves positive feedback.

Answered: 1 week ago