Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!kunivv1!ge From: ge@kunivv1.sci.kun.nl (Ge' Weijers) Newsgroups: comp.sys.handhelds Subject: Re: Fast sorting and re-ordering routines for HP-28S Message-ID: <553@kunivv1.sci.kun.nl> Date: 4 Dec 89 09:45:51 GMT References: <4533@druhi.ATT.COM> Distribution: comp Organization: University of Nijmegen, The Netherlands. Lines: 29 neal@druhi.ATT.COM (USENET News Administrator) writes: >I typed in the sort function from the reference manual and was very >disappointed with it. First of all, it uses a bubble sort, which >may be the most overused bad example around. As Knuth said in 1973, >"In short, the bubble sort seems to have nothing to recommend it, except >a catchy name and the fact that it leads to some interesting theoretical >problems." >I implemented an insertion sort algorithm which is faster still, especially >for data which is already nearly in order, but it still takes >around 2 minutes to sort 50 random numbers (without using FAST). Well, insertion sort is only better than bubble sort by a constant factor. I'll try to write a sort routine that sorts 50 numbers in 30 seconds or so. This should be possible. (I hope) >It would seem that a natural way to speed things up would be to develop >a machine-language implementation of the inner loop of the program. Only after you've used a better algorithm. I'll get back on this. >-Neal McBurnett, neal@druhi.att.com or att!druhi!neal Ge' Weijers, ge@cs.kun.nl Ge' Weijers Internet/UUCP: ge@cs.kun.nl Faculty of Mathematics and Computer Science, (uunet.uu.net!cs.kun.nl!ge) University of Nijmegen, Toernooiveld 1 6525 ED Nijmegen, the Netherlands tel. +3180612483 (UTC-2)