Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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. #include

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago

Question

LO2 Identify components of workflow analysis.

Answered: 1 week ago