- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Wave)
The following pseudocode is given:
I have to describe the function of [m] partition [/m] at the array: $A= \langle 13, 19, 9, 5, 12, 8, 7, 4, 21, 2, 6, 11 \rangle$.I found the following:
View attachment 4066
So the final form of the array is:View attachment 4067
But how could I describe the function of [m] partition [/m] at the array? (Thinking)
The following pseudocode is given:
Code:
partition(A,p,r){
x<-A[r]
i<-p-1
for j<-p to r-1
if A[j]<=x then
i<-i+1
swap(A[i],A[j])
swap(A[i+1],A[r])
return i+1
View attachment 4066
So the final form of the array is:View attachment 4067
But how could I describe the function of [m] partition [/m] at the array? (Thinking)