Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: All Sorts of Sorts Message-ID: <516.UUL1.3#5129@willett.UUCP> Date: 21 Feb 90 02:19:27 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 23 Date: 02-19-90 (10:10) Number: 2933 (Echo) To: DON MADSON Refer#: 2918 From: IAN GREEN Read: NO Subj: LEARN TO SORT Status: PUBLIC MESSAGE Well, in my application where I used the bubble sort, I decided to use that algorithm because of the data-structure I chose. It is simply an array of records. Now since it is an array (to be sure a simple data structure), insertion and deletion is trivial; to insert just add a record to the first 'blank' entry, to delete, change an entry to 'blank'. Then after editing is completed the bubble sort quickly 'cleans' up the array as the bulk of it is still ordered. The blank entry is designed to represent the highest possible key value so it naturally moves to the end of the list where it belongs. Simple and efficient. Ian Green NET/Mail : British Columbia Forth Board - Burnaby BC - (604)434-5886 ----- This message came from GEnie via willett through a semi-automated process. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'