Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!ira.uka.de!smurf!artcom0!hb.maus.de!ms.maus.de!Kai_Henningsen From: Kai_Henningsen@ms.maus.de (Kai Henningsen) Newsgroups: comp.lang.pascal Subject: Combsort problem Message-ID: <14188@ms.maus.de> Date: 27 Apr 91 12:43:00 GMT Distribution: world,comp Organization: Maus Mailbox Netz - UUCP-Gateway Bremen Lines: 40 Sandro Doro alex @ aureus.sublink.org schrieb am 20.04.1991, 12:44 SD> procedure comb(var x: arraytype; SD> n: aptr); SD> var SD> i,j,gap: aptr; SD> intchange: boolean; SD> hold: tdata; SD> begin SD> intchange:=true; What for? SD> gap:=n; SD> repeat SD> gap:=trunc(gap*1.0/shrinkFactor); SD> if gap<1 then gap:=1; SD> intchange:=false; SD> for j:=1 to n-gap do SD> begin SD> i:=j+gap; SD> if x[j]>x[i] then SD> begin SD> intchange:=true; SD> hold:=x[j]; SD> x[j]:=x[i]; SD> x[i]:=hold SD> end SD> end SD> until (gap=1) and (intchange) ... and NOT intchange! SD> end; SD>Why ? where is the error(s) ? MfG Kai