Re: shell sort


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]

Posted by Alias on August 05, 1999 at 23:27:06:

In Reply to: shell sort posted by skimbles on August 05, 1999 at 20:12:24:

: I am having trouble getting good numbers when perfomring the shell sort. I think this is because of my increment. I read in the book that an increment based on a division of 3 works well, but i couldn't get that to work.. any suggestions? thanks

I had similar problems. First make sure the shell sort is runing insort2 on all sublists with a certain increment, not just the first one. Then make sure that insort2 is incrementing by the increment instead of 1 in all the appropriate places. There are a lot of places: in the loops, in the swaps, in the comparisons, ...

I found that the Shell factor of 3 works best most of the time. I don't know if this is a coincedence, or if the book is actually correct.



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]