From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,45ddc3833360d8d8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!e5g2000yqn.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: Shell Sort Date: Sat, 10 Jul 2010 09:17:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: <609b718c-aede-4696-aaab-4106d277c0a0@e5g2000yqn.googlegroups.com> References: NNTP-Posting-Host: 174.28.205.195 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1278778639 13548 127.0.0.1 (10 Jul 2010 16:17:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 10 Jul 2010 16:17:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e5g2000yqn.googlegroups.com; posting-host=174.28.205.195; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.10) Gecko/20100504 Firefox/3.5.10 ( .NET CLR 3.5.30729; .NET CLR 4.0.20506),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:12312 Date: 2010-07-10T09:17:19-07:00 List-Id: Never mind, I fixed it. Procedure Sort( Input : in out ARR ) is Gaps : constant array(Positive Range <>) of Integer:= (1, 4, 10, 23, 57, 132, 301, 701, 1750); Initial_Gap_Index : Integer; begin If Input'Length > 1 then For Index in reverse Gaps'Range loop Initial_Gap_Index:= Index; exit when Gaps(Initial_Gap_Index) < Input'Length; end loop; For GapIndex in reverse Gaps'First..Initial_Gap_Index loop Insertion: declare Inc : Integer:= Gaps(GapIndex); Next : Integer; Done : Boolean; begin while True loop Done:= True; For Index in Input'First..Input'Last-Inc loop -- First Element Next:= Index + Inc; -- Next Element if Input(Next) < Input(Index) then Swap(Input, Index, Next); -- Not finished Done:= False; -- ...keep goin` end if; end loop; Exit When Done; end loop; end Insertion; end loop; end if; end Sort;