SORTING on the HP71 =================== I have found that most sorting routines are either economical of memory and slow or wasteful of memory and fast. A good while ago I found a filename sorting program on one of the Swap Discs and have altered it in several ways to produce a suite of programs that all sort lists of textlines in a DATA file. At first the sorting routine was perfectly adequate but as the files got larger the sorting time became unacceptable. I tried to understand how the routine worked but I found it too complex for me. The need for something simpler, and quicker, prompted me to produce one of my own. SUBSORT is what I came up with. Incorporation Instructions -------------------------- 1. The subroutine assumes that R = the number of non-blank lines in the DATA file. 2. The user must DIMension S$[n],F$[n] where n = the maximum number of characters on each line. 3. The DATA file has been READ into D$(). 4. Flag 0 must be available for use within this subroutine. Limitations ----------- Apart from the obvious one of having enough memory to accomodate the 'scratch' arrays, I am not aware of there being any. I have tested it for odd and even length arrays, arrays in alphabetic order and arrays in reverse alphabetic order, jumbled-up arrays (the usual kind) and arrays with duplicate entries. Provision has also been made for an early exit from the sorting routine should a fully sorted array be achieved before S>=F. Requests -------- Should any user be able to suggest improvements to this routine that would achieve reductions in sorting times I would welcome them. Mark Cracknell, 6 Stratton Mews, Off South Street, Leighton Buzzard, Bedfordshire LU7 8NT, England. 0525-383265