[comp.lang.pascal] Sorting

DUENTSCH%DOSUNI1.BITNET@uga.cc.uga.edu ( Ivo Duentsch) (06/14/91)

Can someone give me a pointer to a routine (preferably Turbo Pascal,
but anything will do) which will sort large files consisting of
reals (ca 300,000) ?
Help will be much appreciated.

Ivo Duentsch
Universitaet Osnabrueck
Germany

bitnet: duentsch@dosuni1

dm2368@eecs1.eecs.usma.edu (Fichten Mark CPT) (06/15/91)

> From: Ivo Duentsch <DUENTSCH%DOSUNI1.BITNET@uga.cc.uga.edu>
> Subject:      Sorting
> 
> Can someone give me a pointer to a routine (preferably Turbo Pascal,
> but anything will do) which will sort large files consisting of
> reals (ca 300,000) ?
> Help will be much appreciated.

What you probably need is an 'external sorting' routine.  Check out any
good book on algorithms or data bases and you should find a discussion
of external sorting.

External sorts are used when the data to be sorted can NOT fit into
memory all at one time.  I don't think you can get 300,000 reals into
memory on a DOS machine at one time!

Internal sorts are used when you CAN fit the data in memory.

Check out the book Computer Algorithms - Introduction to Design and
Analysis by Sara Baase, pages 89-93.  The algorithm is called external
sort with four files and is a polyphase merge sort.  It is extremely
easy to program in Pascal and with a fast hard drive will run fairly
quickly.

Good luck!
____________________________________________________________________________

CPT Mark Fichten      | INTERNET: fichten@eecs1.eecs.usma.edu              |
Captain U.S. Army     |           @trotter.edu:dm2368@eecs1.eecs.usma.edu  |
Work: (914) 938-5580  | USENET:   rutgers.edu!trotter!eecs1!dm2368         |
                      |           harvard.edu!trotter!eecs1!dm2368         |
____________________________________________________________________________