develooper Front page | perl.perl5.porters | Postings from July 2004

Re: optimizing Short circuiting sort method based on [M]

david nicol
July 5, 2004 16:06
Re: optimizing Short circuiting sort method based on [M]
Message ID:
On Tue, 2004-06-29 at 18:24, Glenn Linderman wrote:

> I'm not sure offhand how many result elements are at the crossover 
> between where bubble sort is best and heapsort becomes best, but I 
> believe both of  those will generate entries in sorted order faster than 
> sorting the whole array to throw away most of the results.

That is what I was trying to figure out, and I would like peer review
on my result of bubble for five or less and heap for six or more.  M=5
is the judgement call, giving always two (after the unavoidable initial
comparison) in insertion mode whereas bubble gives an expected two with
random data.

david nicol
this message was sent from a filtering e-mail address.
Until I add you to my friends list, to get by Big Emet
the cowboy doorman your reply must include a listed
"magic phrase" such as "cat and buttered toast" Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About