Question: Hello I need to implement two sorting algorithms. Using NetBeans 8.2 and Java language. First algorithm is Selection Sort and the Second algorithm is Quicksort.

Hello I need to implement two sorting algorithms. Using NetBeans 8.2 and Java language.

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.

Also, all programming languages have ways to get elapsed time in milliseconds. The basic idea is to get the time (in milliseconds) before sorting, after sorting, and then find the difference between them.

The input will be a file of 10 random numbers that will have to be sorted by both algorithm. You can create the file using the example below.

Here is an example of the input of 10 random numbers.

10.txt:

258824 -174147 378540 437671 107242 -50970 97802 -400696 -466378 176930

Here is an example of how it should look after running the program.

Hello I need to implement two sorting algorithms. Using NetBeans 8.2 and

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

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!