On 5/27/2010 15:29, Reimar Grabowski wrote:
On Thu, 27 May 2010 13:53:17 +0100
Martin<[email protected]> wrote:
IMHO the exact style ot intend is mostly a
matter of taste. Wahtever you grew up with (or are used too), seems most
readable.
+1
procedure quicksort;
procedure sort(l,r: index);
var i,j: index; x,w: item;
is something missing? what are the "index" and "item" types?
begin i := l; j := r;
x := a[(l+r) div 2];
repeat
while a[1].key< x.key do i := i+1;
while x.key< a[j].key do j := j-1;
if i<= j then
begin w := a[i]; a[i] := a[j]; a[j] := w;
i := i+1; j := j-1
end;
until i> j;
if l< j then sort(l,j);
if i< r then sort(i,r)
end;
begin sort(1,n)
end;
Dr. Dr. h. c. Niklaus Wirth
Algorithmen und Datenstrukturen
2. Edition
Stuttgart 1979
page 117
R.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus