Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Answer in Java with output please :) ASSIGNMENT #6-Sorting Write a complete program to collect statistics on a series of sorts. The main program will
Answer in Java with output please :)
ASSIGNMENT #6-Sorting 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 subprogram to read a group of numbers to be sorted 2. Call a subprogram to sort these values using three sorts 3. Call a subprogram to compare the three sorts STEP 1: The read subprogram will first read a heading describing the group of numbers (eg the heading might be: 10 numbers in order, or 50 numbers in a random order or 100 numbers in reverse order). Then it will read in the group of numbers. The original group should be printed as it is read in. STEP 2: The threesort subprogram will call three separate sorts (be sure to send each one the items in their original order): a. One sort will be a stupid one either linear or bubble b. One sort will be quicksort c. One sort will be any other good one of your choice (eg heapsort) After each individual sort subprogram finishes, the sorted array should be printed. Also print the number of comparisons each sort needed and the of times elements were interchanged. (These values must be computed within the three individual sorting subprograms. Use either additional parameters or global variables, but be sure to include comments.) STEP 3: The comparison subprogram will determine which sort used the most comparisons, which was in the middie, and which used the least. It will do the same thing for interchanges. DATA: 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): 1. 10 numbers in almost sorted order (two or three numbers interchanged) 2. 10 numbers in random order 3. 10 numbers in reverse order 4. 50 numbers in almost sorted order (a few out of order) 5. 50 numbers in random order 6. 50 numbers in reverse order 7. 100 numbers in almost sorted order (a few out of order) 8. 100 numbers in random order 9. 100 numbers in reverse order OPTIONAL: 1. Construct a sort which minimizes the number of interchanges (note: interchanges, not comparisons) 2. Construct a way to generate 50 (or 100) numbers, numbered 1-50 (or 1-100), without repeats, in random orderStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started