Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!yale.edu!cmcl2!adm!news From: dm2368@eecs1.eecs.usma.edu (Fichten Mark CPT) Newsgroups: comp.lang.pascal Subject: Re: Sorting Message-ID: <27209@adm.brl.mil> Date: 14 Jun 91 18:50:27 GMT Sender: news@adm.brl.mil Lines: 32 > From: Ivo Duentsch > 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 | ____________________________________________________________________________