Question: Create a java program that a) is passed a random list of numbers, uses a selection sort to sort the array and prints the array

Create a java program that

a) is passed a random list of numbers, uses a selection sort to sort the array and prints the array out sorted

b) is passed a random list of numbers (a new list), uses a insertion sort to sort the array and prints the array out sorted.

You should have a single class file, with two methods defined. Do your own sort algorithms, one for selection sort and the other for insertion sort.

In your main program, use random to create an array of numbers (integers or reals), and print it out.

Call your selection sort method passing your random array, and print the sorted array.

Call your insertion sort method passing your random array, and print the sorted array. Do NOT USE Array.sort() to do the sorting.

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!