Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fast sort? - Bubble Sort!? (Question to Dr. Hyatt)

Author: Robert Hyatt

Date: 12:40:50 10/20/99

Go up one level in this thread


On October 20, 1999 at 13:22:26, Dann Corbit wrote:

>On October 20, 1999 at 10:21:04, Robert Hyatt wrote:
>[snip]
>>Right... but count the memory references.  My moves _must_ be put in the
>>right array (the array where they are stuck when they are generated.)  This
>>means that I copy them to another array, then 'insertion sort' them back to
>>the original array, which copies each element twice.  Bubble sort eats that
>>alive in terms of total instructions, number of memory references, and
>>number of cache misses.  For very small N of course.
>
>Insertion sort is stable and in-place.


It is stable, but it isn't "in place" in the context that you have a complete
list _before_ you can start the insertion sort.  IE I start with the list of
moves _before_ I even get a chance to do anything with them.  Now I have to
get that list in order based on scores in another vector.  I am going to have to
do the insertion sort into a second array, then copy this back over the first
array, or else do the same sort of 'shuffling' I do in the bubble sort.

Convince me it is faster and I'll certainly change, as I never look 'speed' in
the mouth.  :)



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.