Newsgroups: comp.sys.amiga.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!hobbes.physics.uiowa.edu!maverick.ksu.ksu.edu!unlinfo.unl.edu!fergvax!231b3678 From: 231b3678@fergvax.unl.edu (Phil Dietz) Subject: Re: Combsort algorithm Message-ID: <231b3678.676251482@fergvax> Sender: news@unlinfo.unl.edu Nntp-Posting-Host: fergvax.unl.edu Organization: University of Nebraska - Lincoln References: <191d6f59.ARN12eb@pilhuhn.ka.sub.org> <8235@oasys.dt.navy.mil> <8236@oasys.dt.navy.mil> Date: 6 Jun 91 23:38:02 GMT Lines: 23 In <8236@oasys.dt.navy.mil> tdsmith@oasys.dt.navy.mil (Timothy Smith) writes: >>it to sort (23 41 55 12 11 9 10) with only 7 moves. I'm skeptical! >er, with only 7 "reads". Sorry about the second posting. >>Tim Simply use a hash function of f(x) = x The only way a bucket sort can work is to know ahead of schedule, how many buckets will be needed. From the example above, I'm assuming that there are at least 55 buckets...all initialized to some null value. When you get 23, simply toggle bit 23 or set array[23] to 1 etc. etc. When you hit 10, you are done with the list and they are all sorted (you must skip NULLS when printing). Hash functions are very nice, but they many limitations... ---- Quote #4 Phil Dietz " " 231b3678@fergvax.unl.edu -- Invisible Man University of Nebraska