Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!spool.mu.edu!munnari.oz.au!uhccux!uhheph.phys.hawaii.edu!ralph From: ralph@uhheph.phys.hawaii.edu (Ralph Becker-Szendy) Newsgroups: comp.lang.fortran Subject: Re: QuickSort w/o recursion. Summary: Read numerical recipes Message-ID: <12120@uhccux.uhcc.Hawaii.Edu> Date: 24 Mar 91 11:18:31 GMT References: Sender: news@uhccux.uhcc.Hawaii.Edu Distribution: comp Organization: U of Hawaii High Energy Physics Lines: 38 In article quan@sol.surv.utas.edu.au (Stephen Quan) writes: >I am in desperate seek of ideas on how to implement "QuickSort" or other >optimin sorting algorithm without the use of recursion, our Sun Fortran >(F77 version 1.2 on SunOS 4.0) compiler doesn't support recursion very >well. > >At the moment I'm using a bubble sort and it is inadequate with the data >I am working with. (A file/table of 80000 integer pairs). > >Stephen Quan, >quan@sol.surv.utas.edu.au, >University of Tasmania, >Surveying Dept., >Australia. Questions like this prove that "the book" has to be read by more people. Here is the answer: Numerical Recipes, by Press/Flannery/Teukolsky/Vetterling, Cambridge Univ Press. Comes with FORTRAN example programs. A reasonably good sorting routine is among them, you can just type it in (there is also an example disk in MS-DOS format one can cuy with the book), for people too lazy to type the examples in. Page 235 has a pretty short quicksort program. Not the world's greates sorting routine, but good enough for most problems. The same program in PASCAL is in an appendix, and a version of the book in C is available too. As another reader of this group pointed out a while ago (in no uncertain words), "the book" is not the state of the art. It is not even the greatest textbook of numerical mathematics. But it contains lots of handy example programs (which work more or less, they are examples after all), and it explains the principles of numerical work. I think it is a very good book WITH LIMITATIONS. -- Ralph Becker-Szendy UHHEPG=24742::RALPH (HEPNet,SPAN) University of Hawaii RALPH@UHHEPG.PHYS.HAWAII.EDU High Energy Physics Group RALPH@UHHEPG.BITNET Watanabe Hall #203, 2505 Correa Road, Honolulu, HI 96822 (808)956-2931