Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java In this program we will look at three variations of quicksort. We will compare them on ten randomly generated lists of 1000 items. In

Java

image text in transcribed

In this program we will look at three variations of quicksort. We will compare them on ten randomly generated lists of 1000 items. In addition, we will look at the algorithms' performance on both a sorted and reverse sorted (sorted highest to lowest) version of each list. We will look at the behavior of three different versions of quicksort on randomly generated lists of size 1000. .The three versions of quicksort are described below. Randomly generate integers in the range 0-99 for your random numbers. You may choose your own random number generation technique (this is an exception to the no-outside-help requirement for this assignment. You must document the source of your random number generation in the code. Here is what vour code should do: 1. Do this 10 times: Generate a random list of 1000 items. Make a sorted version of the list. Use whatever sort you want to do this. You do not need to demonstrate, annotate, etc. this sort. Make a reverse-sorted [ie. high to low) version of the list. Modify whatever sort you want to do this. You do not need to demonstrate, annotate, etc. this sort. Have each version of quicksort sort each of the three lists Give the original list, the sorted list, and the number of comparisons done by each version of the algorithm. a. b. c. d. e. 2. At the end: For each quicksort version and each list type (random, pre-sorted, reverse- sorted) give the average of the number of comparisons a. Quicksort Versions Here are the three versions of quicksort to use. Basic Quicksort. (the version given in pp. 1090-1094 in Gaddis & Muganda, and Section 7.1 in Sedgewick) Random Pivot Point. The partition algorithm randomly pick an index value of the the array it is looking at. The array element at the location is the partition value Median-of-three Partitioning. Quicksort tends to work best when the partition value is one that is in the middle range of the values to be sorted. Middle-of-three partitioning tries to be a quick way to do this. How it works is that it looks at the elements at the first position, the last position, and the middle element of the array. Whichever of those three is the median (not the smallest, not the largest, but the middle value) is chosen as the partition value for the partition 1. 2. 3

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions