Question: nested procedure (quick sort)

Dear those who are in Mapleprimes,

 

As I can't understand how Maple calculate the quick sort, I write the present question, hoping that someone give me a hint.

In essence, nested procedure I cannot understand is this:

 

quicksort:=proc(A,m,n)

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

if m<n then

quicksort(A,m,p-1);.................................(1)

quicksort(A,p+1,n)...................................(2) 

end if;

eval(A);

end proc:

 

Details were ommitted, but I have to say that p is the number between m and n, which is determined by ommitted parts of 

the procedure.

And, with this nested procedure, 

quicksort([2,4,1,5,3],1,5) is calculated.

 

What I want to know is how to process the parts of (1) and (2).

If after (1) is processed, (2) is processed, what is the value of p in (2).

Is it the p which is determined successively through processing nested value of (1)?

 

Thank you in advance.

 

taro

Please Wait...