Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help with sorting in java Directions Problem 1 : Write (using pen-and-paper rather than code) the list after each pass of quick and merge

need help with sorting in java

Directions

Problem 1: Write (using pen-and-paper rather than code) the list after each pass of quick and merge sort for the following list of numbers. Assume that you are sorting the numbers into ascending order. For quick sort, assume that the first number from the sublist is chosen as the pivot.

54 17 21 18 4 7 19 41 -> need a quick sort merge of these numbers and a merge sort two different styles. please show each pass. (2 different lists)

Problem 2: Write the list after each pass of the quick sort algorithm for the following list of numbers, using the following pivot selection strategies: first value of the sublist, middle (not median) value of the sublist, and the median of the first, middle, and last values. Assume you are sorting the numbers into ascending order. For example, in the first pass of the algorithm on these numbers, the first pivot selection strategy chooses 54, the middle strategy chooses 18 (because 18 and 4 are in the middle of the list; when the list is of even length, we can just choose to go with the first of the two middle values), and the median of the first, last and middle values chooses 41 as the pivot value, because 41 is the median of 54, 18 and 41. Repeat the above for this list of numbers. Remember that you are sorting into ascending order.

92 47 29 22 21 20 16 14 -> need a quick sort list of these numbers for each pass. (please show each pass)

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions