Path: utzoo!attcan!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: All Sorts of Sorts Message-ID: <451.UUL1.3#5129@willett.UUCP> Date: 13 Feb 90 02:31:37 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 37 Date: 02-11-90 (08:41) Number: 2884 (Echo) To: IAN GREEN Refer#: NONE From: STEVE PALINCSAR Read: NO Subj: SORTING ALGORITHMS] Status: PUBLIC MESSAGE As a matter of fact, even as august an authority as Knuth says that for some sorts of data, the selection sort happens to be the best one available. But besides that, your assumption that "the real world" consists only of massive databases simply takes my breath away. As it happens, the application that I translated KNuth into Forth for is a real-world application for a task I do at work. Every month I do a search on a Library of Congress bibliographic database on their inhouse SCORPIO system and I download a list of their reports added since the previous issue. (That's usually between 60 and 100 or so items.) The entries are downloaded in report number order. My program strips off the unnecessary material from each citation, and puts the cites in author title order. In fact, I think the requirement to order the data came about because one of the editors of the publication secretly wished to eliminate the column, and thought that the amount of manual effort required to do so would cause me to simply abandon the effort. Ha! Using this program it takes me about 30 seconds to process the data. As it so happens, she's taking over production of the column, and was astounded at how easy it was... Incidentally, if you'll stop to consider the situation, you'll see that the bubble sort is less efficient than the selection sort - so by your own criteria you oughtn't be using it! But as we both know, there are times in the real world that you need to sort relatively small numbers of items, and in such cases more complex algorithms may be even slower than the simple ones. Even Knuth says so... ;-) ----- 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'