home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / misc / 4075 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.3 KB  |  26 lines

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