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
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