I need help with this, please. I started from the pivot (left side) look for a number greater than the pivot and start from the right side looking for a number less than the pivot then we swap these two, the pivot is 59, I reached a step where I swapped the pivot 59 with 13 since the two indices cross (coming from left and coming from right) and at that point we stop and we swap the pivot (59) with what we got coming from the right, but the problem is when i did that to the right of 59 is 42 which is smaller. I have a demonstration of how the answer must be in each blank but for a different example. Note that by the end (blank 3) not everything must be sorted, that's fine. I attached the question and the demonstration how each blank should be. Please provide what the answers for each blank must be and why

icon
Related questions
Question

I need help with this, please. I started from the pivot (left side) look for a number greater than the pivot and start from the right side looking for a number less than the pivot then we swap these two, the pivot is 59, I reached a step where I swapped the pivot 59 with 13 since the two indices cross (coming from left and coming from right) and at that point we stop and we swap the pivot (59) with what we got coming from the right, but the problem is when i did that to the right of 59 is 42 which is smaller. I have a demonstration of how the answer must be in each blank but for a different example. Note that by the end (blank 3) not everything must be sorted, that's fine.

I attached the question and the demonstration how each blank should be. Please provide what the answers for each blank must be and why

Quicksort example:
49 37 17 76 60 29 11 28 90 42 99 85 97 68 34 75
۱۹۶۱۶۰ ، ۹۶ ۶۲ ۶۱ 68 26 1
{ s .
{ { ) ( ۴۲ ؟؟ .
14 3.1 | 3,1 41 15
| || |24 | 11 4 19 }} | ۹۲| 50
17 11
| || || 11 4 21 1+ ۹۹ | ٠(
٦٤ 13 13 ، ۶۰ ۶۶ ۶۶
Transcribed Image Text:Quicksort example: 49 37 17 76 60 29 11 28 90 42 99 85 97 68 34 75 ۱۹۶۱۶۰ ، ۹۶ ۶۲ ۶۱ 68 26 1 { s . { { ) ( ۴۲ ؟؟ . 14 3.1 | 3,1 41 15 | || |24 | 11 4 19 }} | ۹۲| 50 17 11 | || || 11 4 21 1+ ۹۹ | ٠( ٦٤ 13 13 ، ۶۰ ۶۶ ۶۶
For this question you will perform two levels of quicksort on an array containing
these numbers:
59 41 61 73 43 57 50 13 96 88 42 77 27 95 32 89
In the first blank, enter the array contents after the top level partition.
In the second blank, enter the array contents after one more partition of the left-
hand subarray resulting from the first partition.
In the third blank, enter the array contents after one more partition of the right-hand
subarray resulting from the first partition.
Print the numbers with a single space between them.
Blank # 1
Blank # 2
Blank # 3
Transcribed Image Text:For this question you will perform two levels of quicksort on an array containing these numbers: 59 41 61 73 43 57 50 13 96 88 42 77 27 95 32 89 In the first blank, enter the array contents after the top level partition. In the second blank, enter the array contents after one more partition of the left- hand subarray resulting from the first partition. In the third blank, enter the array contents after one more partition of the right-hand subarray resulting from the first partition. Print the numbers with a single space between them. Blank # 1 Blank # 2 Blank # 3
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer