TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Roy Mcneill
from: Bob Lawrence
date: 1996-12-09 07:53:08
subject: Bloody C

RM> If your object is a sorting routine, and not an in-depth C
 RM> lesson, try writing your own.

  My object is an in-depth C lesson. I can roll my own, no worries. 

 RM> The first time I tried qsort(), I
 RM> had much the same trouble as you're having, so I found a book
 RM> and wrote a quicksort from scratch, building the comparison
 RM> routine right in. Worked well, and was probably a tad faster
 RM> cos it avoided the overhead of the function call.

  I already did that, Roy. Mine was actually slower than qsort() but.

  I was trying to work out WTF with qsort() before I was rudely
interrupted by a stopping heart. I think god was trying to tell me to
go back to Pascal.

 RM> I've read somewhere that quicksort is a bit overrated. On
 RM> shorter lists, the timesaving can be pretty well negligible,
 RM> and on "almost sorted" lists, some simpler routines can
 RM> actually be faster. The simpler ones are a bit easier to write,
 RM> and don't make heavy demands on the stack (repeated recursive
 RM> function calls) on long lists.

  I agree. Been there, done that.

Regards,
Bob

___ Blue Wave/QWK v2.12
@EOT:

---
* Origin: Precision Nonsense, Sydney (3:711/934.12)
SEEN-BY: 711/934 712/610
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.