Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the Java code for that. Someone please help me for that. thanks. 37% 2:40 X Question HOME WORK NO due 05.08.2018 (Quick Sort)

image text in transcribed

I need the Java code for that. Someone please help me for that. thanks.

37% 2:40 X Question HOME WORK NO due 05.08.2018 (Quick Sort) The recursive sorting technique called quicksort uses the following basic algorithm for a one dimensional array of valus A) Partitioning Step: Take the first element of the unsorted array and determine its final location in the sorted array (i.e., all values to the left of the element in the array are less than the element, and all values to the right of the element in the element in the array are greater than the element-we show how to do this below) We now have one element in its proper location and two unsorted subarrays B) Recursive Step: Perform Step 1 on each unsorted subarray. Each time Step I is performed on a subarray, another element is placed in its final location of the sorted array, and two unsorted subarrays are created. When a subarray consists of one element, that element is in its final location. The basic algorithm seems simple enough, but how do we determine the final position of the first element of each subarray? As an example consider the following set of values (the element in bold is the partitioning element - it will be placed in its final location in the sorted array) 37 264 89 8 10 12 68 45 Starting from the rightmost element of the array, compare each element with 37 until an element less than 37 is found; then swap 37 and that element. The first element less than 37 is 12, so 37 are swapped. The new array is 1226489 8 10 37 68 45 Element 12 is an italics to indicate that it was just swapped with 37 Starting from the left of the array, but beginning with the element after l compare each element with 37 until an element greater than 37 is found- then swap 37 and that element. The first element greater than 37 is 89, so 37 and 89 are swapped

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions