(!****************************************************** Mosel User Guide Example Problems ================================= file qsort1.mos ``````````````` 'forward' definition of subroutines. (c) 2008 Fair Isaac Corporation author: Y. Colombani, 2001 *******************************************************!) model "Quick sort 1" parameters LIM=50 end-parameters forward procedure qsort_start(L:array(range) of integer) (! Equivalent form of declaration: declarations procedure qsort_start(L:array(range) of integer) end-declarations !) declarations T:array(1..LIM) of integer end-declarations forall(i in 1..LIM) T(i):=round(.5+random*LIM) writeln(T) qsort_start(T) writeln(T) ! Swap the positions of two numbers in an array procedure swap(L:array(range) of integer,i,j:integer) k:=L(i) L(i):=L(j) L(j):=k end-procedure ! Main sorting routine procedure qsort(L:array(range) of integer,s,e:integer) v:=L((s+e) div 2) ! Determine a partitioning value i:=s; j:=e repeat ! Partition the array into two subarrays while(L(i)v) j-=1 if i=j ! Recursively sort the two subarrays if js and i