Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fast way to sort moves in movelist ?

Author: Ricardo Gibert

Date: 16:31:20 10/15/99

Go up one level in this thread


On October 15, 1999 at 18:50:21, Jeremiah Penery wrote:

>On October 15, 1999 at 18:24:57, Ricardo Gibert wrote:
>
>>On October 14, 1999 at 18:00:02, Robert Hyatt wrote:
>>
>>>On October 14, 1999 at 10:02:18, stefan wrote:
>>>
>>>>What do you think sort (and if yes how) or search move by move?
>>>>
>>>>Thank you
>>>>stefan plenkner
>>>
>>>
>>>The only 'sort' I do is to sort captures based on expected material gain/loss
>>>(SEE score).  There are usually a very few, so I use a simple bubble sort
>>>which works well.
>>
>>Perhaps you meant to say "insertion sort" instead of "bubble sort". Sedgewick
>>comment about bubble sort: "It is not clear why this method is so often taught,
>>since insertion sort seems simpler and more efficinet by almost any measure. The
>>inner loop of bubble sort has about twice as many instructions as either
>>insertion sort or selection sort."
>
>He does do a bubble sort. :)  It says in the code something like:  "Don't
>disdain the lowly bubble sort here. :) Experimentation with other algorithms has
>always been slightly slower."
>
>Jeremiah :)

If he is using bubble sort, then there is a simple enhancement he can make
called shaker sort. A bubble sort where the inner alternately reverses
direction. This enhancement can be achieved 'for free'. There is no reason to be
using bubble sort.



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.