qsort(), bsearch(), and rude comparison functions
Evan Marshall Manning
manning at nntp-server.caltech.edu
Wed Oct 10 09:16:12 AEST 1990
flee at guardian.cs.psu.edu (Felix Lee) writes:
>A pathological comparison function might shuffle the array being
>sorted each time it's called, in which case qsort() may never
>terminate. Is this prohibited?
I myself have used qsort with a comparison function which used
rand() to generate a positive or negative number. I was prepared
for it to go on forever, but it terminated with the array fully
shuffled.
***************************************************************************
Your eyes are weary from staring at the CRT for so | Evan M. Manning
long. You feel sleepy. Notice how restful it is | is
to watch the cursor blink. Close your eyes. The |manning at gap.cco.caltech.edu
opinions stated above are yours. You cannot | manning at mars.jpl.nasa.gov
imagine why you ever felt otherwise. | gleeper at tybalt.caltech.edu
More information about the Comp.std.c
mailing list