Question
Hello I need to implement two sorting algorithms in JAVA language using NetBeans 8.2. First algorithm is Selection Sort and the Second algorithm is Quicksort.
Hello I need to implement two sorting algorithms in JAVA language using NetBeans 8.2.
First algorithm is Selection Sort and the Second algorithm is Quicksort. The Quicksort algorithm must use the median-of-three method to determine the pivot and must use the Hoare Partition algorithm.
They should sort the numbers in ascending order (smallest to largest). In the main method which actually do the sorting, ask the user which sorting algorithm to use.
You must also have a function confirmSorted(). This function should take your array of numbers, verify that it is sorted in ascending order, and return a Boolean. If the numbers are confirmed to be sorted, print out Confirmed sorted and if they arent sorted, print out Confirmed NOT sorted. Do this before and after the sort.
The input will be a file with 10 random numbers that will have to be sorted by both algorithm.
Here is an example of the input to use of 10 random numbers.
10.txt:
258824 -174147 378540 437671 107242 -50970 97802 -400696 -466378 176930
This image is just an example of the program running an input of 100000 random numbers.
The Elapsed Time is in C++ when it has to be in JAVA and milliseconds for the time.
Sample output Below is an idea of What kind of output your program should have Reading data from 100000.txt Confirmed NOT sorted Sorting using Quicksort. It took 150 ms. Confirmed Sorted. Getting Elapsed Time Below is some code in C++ to get a rough estimate of elapsed time. #includeStep 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