Consider the array A[1..7] = {2, 20, 10, -5, -15, 25, -10}. Running the PARTITION procedure of QuickSort (as described in class and the notes) on this list, with the first element as pivot (2 in this case) produces the following lists: (a) A[1..3] = {-15, -10, -5} and A[4..7] = {10, 20, 25, 2} (b) A[1..3] = {-10, -15, -5} and A[4..7] = {20, 10, 25, 2} (c) A[1..3] = {-10, -15, -5} and A[4..7] = {10, 20, 25, 2}

icon
Related questions
Question
Consider the array A[1..7] {2, 20, 10, -5, -15, 25, -10}. Running the PARTITION procedure of
QuickSort (as described in class and the notes) on this list, with the first element as pivot (2 in this
case) produces the following lists:
(a) A[1..3] = {−15, −10, −5} and A[4..7]
(b) A[1..3] = {−10, -15, -5} and A[4..7]
(c) A[1..3] = {-10, −15, −5} and A[4..7] =
=
=
=
{10, 20, 25, 2}
{20, 10, 25, 2}
{10, 20, 25, 2}
Transcribed Image Text:Consider the array A[1..7] {2, 20, 10, -5, -15, 25, -10}. Running the PARTITION procedure of QuickSort (as described in class and the notes) on this list, with the first element as pivot (2 in this case) produces the following lists: (a) A[1..3] = {−15, −10, −5} and A[4..7] (b) A[1..3] = {−10, -15, -5} and A[4..7] (c) A[1..3] = {-10, −15, −5} and A[4..7] = = = = {10, 20, 25, 2} {20, 10, 25, 2} {10, 20, 25, 2}
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer