Thread View: comp.lang.misc
2 messages
2 total messages
Started by nimcompu
Sat, 19 Dec 1992 04:23
Sorting Algorithm Needed
Author: nimcompu
Date: Sat, 19 Dec 1992 04:23
Date: Sat, 19 Dec 1992 04:23
13 lines
1056 bytes
1056 bytes
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.
Thanks in advance.
nimcompu@oneb.almanac.bc.ca
nimcompu@oneb.almanac.bc.ca (Eric van Wiltenburg)
The Old Frog's Almanac (Home of The Almanac UNIX Users Group)
(604) 245-3205 (v32) <Public Access UseNet> (604) 245-4366 (2400x4)
Vancouver Island, British Columbia Waffle XENIX 1.64
Re: Sorting Algorithm Needed
Author: ac999239
Date: Wed, 23 Dec 1992 23:39
Date: Wed, 23 Dec 1992 23:39
14 lines
1348 bytes
1348 bytes
> 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads