Dear people in Mapleprimes,

I calculated the following Quick Sort algorithm.

restart;

quicksort:=proc(A::array(1,numeric),

m::integer, n::integer)

local partition, p;

partition:=proc(m,n)

i:=m;

j:=n;

x:=A[j];

while i<j do

if A[i]>x then

A[j]:=A[i];

j:=j-1;

A[i]:=A[j];

else

i:=i+1;

end if;

end do;

A[j]:=x;

p:=j;

end proc:

if m<n then

p:=partition(m,n);

quicksort(A,m,p-1);

quicksort(A,p+1,n);

end if;

eval(A);

end proc:

trace(quicksort);

a:=array([2,4,1,5,3]);

quicksort(a,1,5);

Then, in the answer, there was a sentence that

{--> enter , quicksort, , args = , a, , , 2, , , 2

........................

{--> enter , quicksort, , args = , a, , , 4, , , 5

I could understand the reason of the "{--> enter , quicksort, , args = , a, , , 2, , , 2,"

but, I could not understand why 4, , , 5 could appear here. I think there is no reason why n that is the number at 5

increased from 2 to 5. I thought n continues to be 2.

I hope you will give me some hint for this understanding.

I thought it with a lot of time. And, I don't know whether this place is an appropriate place to ask this question.

But, I will be very glad if you teach me some of this.

Best wishes.

taro