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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,f6c360ce344b2364 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Received: by 10.204.149.210 with SMTP id u18mr2330676bkv.1.1340106913637; Tue, 19 Jun 2012 04:55:13 -0700 (PDT) Path: e27ni66053bkw.0!nntp.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 19 Jun 2012 06:55:11 -0500 Date: Tue, 19 Jun 2012 07:55:12 -0400 From: "Peter C. Chapin" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120604 Thunderbird/13.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: My Invention of "Bug Sort". References: <3852c348-a728-44ed-b065-c8a596c1e235@googlegroups.com> In-Reply-To: <3852c348-a728-44ed-b065-c8a596c1e235@googlegroups.com> Message-ID: X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-SUg9PXcFz86ullylg3/UVLOko5bDxp5wCEe5uXUGIOgeG6F2xNlIapiSfrWN+ybrfoi8d//DaQKQ3C+!HtGx/gM9qJL/wmimMG9RQcdVXaSol+1/VkwaUh2Rge7rX1snvKeQVMVPgtcX+AE= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2591 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Date: 2012-06-19T07:55:12-04:00 List-Id: On 2012-06-19 03:13, Austin Obyrne wrote: > Copyright � 2012 Austin O'Byrne. > > Let us say that �NextNum� is a variable in a program output string that the user wants to sort at the end of the program run. > > How it works. > > Each change in �NextNum� is trapped as it is computed by a �bug� strategically placed in the lines of source code. > > Q := NextNum(I); > I_NUM(Q):= I_NUM(Q)+1; > > (This is the bug) > > The bug �gets� (captures) the instantaneous value of NextNum as it materializes and then immediately writes this instantaneous value to a dedicated array in order of *magnitude and returns for the next i.e. each value indexes its own place in the array ( *not in sequential order where the entries would be contiguous and remain unsorted � this is the most salient point for the reader to note). > > *This is defacto sorting per se. > > It only needs to read back from the array to see the sorted string which can be anything up to 1 million or more elements sorted in a split second, to complete the task. I find your style of writing difficult to understand. However, if I follow what you are saying, you are talking about Radix Sort. That sorting method is O(n) instead of O(n log(n)) (which is the best attainable running time for a comparison sort). However in general it can have huge memory requirements and is really only practical in special cases. Peter