home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.misc
- Path: sparky!uunet!haven.umd.edu!news.umbc.edu!umbc8.umbc.edu!ac999239
- From: ac999239@umbc8.umbc.edu (ac999239)
- Subject: Re: Sorting Algorithm Needed
- Message-ID: <1992Dec23.233932.23794@umbc3.umbc.edu>
- Sender: newspost@umbc3.umbc.edu (News posting account)
- Organization: University of Maryland, Baltimore County Campus
- References: <D3H1VB1w164w@oneb.almanac.bc.ca>
- Date: Wed, 23 Dec 1992 23:39:32 GMT
- Lines: 14
-
- > Does anyone have an algorithm in Pascal that sorts names/words
- > alphabetically? I would like one that does items that are three (3) words
- > in length, such as 'Firstname Middlename Lastname.' It may be a simple
- > algorithm but being a programmer who has not done much programming, I have
- > not figured it out yet.
-
- I assume you are using a record to hold the names and I assume you want it
- sorted by last name? Basically just get a sorting algorithm out of any book
- and do the comparison test on the lastname element of the record, but then
- swap the entire record with another if the algorithm calls for it. Having
- an array of this record type is also useful. There are so many sorting
- algorithms out there and alot of books flat out give you the coding for some
- of them. If your library has the book titled PASCAL by Koffman that has lots
- of examples on sorting algorithms.
-