Allsorts of sorts An Article By H.S.Williams Sept. 1991 Welcome to this article on sorting and the routines employed. If you'll excuse the corny title, I'll explain the format of this article. The program that is now running is a caretaker program. It will load and display all the text files that form this article. The entire article comprises of a series of basic programs, and accompanying text files. To get the best of the article, I suggest that you read through the text files as presented by this program ( The title of each file is displayed at the top of the screen as each file is displayed for your reference. ) and then to go through the basic programs with reference to the text files. The text files were written using the Wordwise word processor and should easily load into any other processor for printing. If you do not have a word processor and you want to print out the articles then type in the following, ending each line by pressing the return key. MODE0 VDU2 *TYPE The purpose of this article, or so Duncan tells me is to show the technical side of sorting. Also to provide the fastest sorting routines that I can, supposedly in machine code. The reality may be somewhat different. I'll start with an outline of what I intend to cover. An introduction is always a good start. The first thing to do will be to explain the basic methods behind some of the commonly used sorting routines; bubble, index, shell, and quick. Taking the simplest and most inefficient of these ( the bubble sort ), I'll show how by a sucession of simple modifications it can be made more and more effective. The modification of the bubble sort will lead neatly onto the methods of comparison of sort routines. Also under which conditions different routines are the most effective. After this introduction I will present a sort routine of my own devising. This will demonstrate how memory and speed are often traded off against one another, incredible speed with many limitations. If I get this far I'll then translate the more suitable of the routines so far examined into machine code, this should provide you with some of the fastest sorting routines available. You may include any of the routines presented in this article in your own programs. Examples in the form of basic programs and accompanying text files will be presented along the way.