LPM: RE: Sorting Big Files

llang at baywestpaper.com llang at baywestpaper.com
Wed Dec 15 12:38:25 CST 1999


Hey, that's not half bad.  You're not as...  (Never mind - I keep
forgetting that you have easy access to most of the dirt on me. :-} )


--
Loren Lang               Phone:    606-734-0538 x326
Network Administrator         Fax: 606-734-8210
Bay West Paper Corporation    email:     llang at baywestpaper.com

"There is no greater burden than great potential." - Charles Schultz







Here's my suggestion, similar to many others, but guaranteed to be
linear time:

1. Read each record, and append it (or some key to the record) to a
file whose name is the name of the country. (Create the file if it
doesn't exist already and that sort of jazz.)
2. Sort the filenames.
3. Print out your records from the filename-ordered files.

As long as you don't require any order within countries, this is about
as easy as anything I could come up with. Even if you do, you can operate
within a country by applying the same operation to each file.









More information about the Lexington-pm mailing list