3
answers
1
watching
254
views

Submit the vector [33 44 55 77 95 99 22 25 41 66 88 89] to the Quicksort Partition algorithm. What is the final state of the vector? 
What index does the algorithm return?
 
Partition (Apr)   ▷ p ≤ r
1  x := A[r]   ▷ pivot
2  i := p − 1
3  for j := p to r − 1
4          if  A[ j] ≤ x
5                 i := i + 1
6                change A[i] with A[ j]
7  changeA[i+1] with A[r]
8  return i + 1

For unlimited access to Homework Help, a Homework+ subscription is required.

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in

Weekly leaderboard

Start filling in the gaps now
Log in