Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview: Create a Java program that allows the user to experiment with different multithreaded sort algorithms. You should provide the user with a graphical user

Overview:

Create a Java program that allows the user to experiment with different multithreaded sort algorithms. You should provide the user with a graphical user interface (GUI) like the one below.

The user should be able to select the type of sorting algorithm to be used (selection, bubble, insertion, or quick), the size of the array to sort, the type of values to put in the array (already sorted in ascending order, sorted in reverse (descending) order, or random numbers between 0 and 99), and the number of values to sort in each thread.

When the user clicks on the Go button, you should validate all of the input. If the user has not provided required input or if the input is invalid (a negative input size, for example), you should display an alert dialog explaining the problem.

Rubric:

The program displays a user interface with the requested layout

Pressing the Go button validates the user input and displays an alert dialog if necessary

The program correctly implements selection, bubble, insertion, and quick sort

The program correctly implements the merge method

The program spawns threads to sort chunks of the array with the requested size and using the requested algorithm

The program spawns threads to merge the sorted chunks

The program displays the number of milliseconds the sorting operation took via an alert dialog

image text in transcribed

The output to the console is this:

[0, 2, 2, 2, 3, 5, 5, 6, 7, 8, 9, 9, 13, 13, 15, 16, 17, 17, 19, 21, 23, 24, 25, 26, 27, 27, 32, 32, 32, 32, 33, 34, 35, 35, 36, 36, 37, 38, 38, 38, 39, 39, 41, 41, 43, 44, 45, 45, 46, 48, 48, 49, 50, 50, 53, 53, 54, 54, 54, 55, 55, 55, 60, 61, 62, 62, 63, 63, 63, 63, 65, 66, 68, 69, 69, 69, 72, 74, 74, 76, 76, 76, 78, 79, 80, 80, 81, 82, 82, 85, 85, 86, 87, 88, 89, 92, 95, 98, 98, 99]

And this alert dialog is displayed:

image text in transcribed

Sorting Algorithm Selection Bubble Insertion Quick Input Type Already sorted Reverse order Random Input Size 100 Block Size 10 GO Sorting Algorithm Selection Bubble Insertion Quick Input Type Already sorted Reverse order Random Input Size 100 Block Size 10 GO

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 A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

Students also viewed these Databases questions