On Sun, 24 Apr 2011 08:58:07 +1000
Peter E Williams <[email protected]> wrote:

> Hi All,
> 
> I am having a problem with a strange run-time AV error. See the link to the
> Lazarus project.
> 
> Download link:
> http://hotfile.com/dl/115480488/6b7a8ed/dtm_maker_001.zip.html
> 
> The problem is in the QSort procedure:
> 
>[...]
>     pivot := island_single_array[left].location_number;

"pivot" is the key of the pivot element at position "left".

>[...]
>     pivot := island_single_array[left].location_number;
>     left := lower1;
>     right := upper1;
>     if left < pivot then
         ^^^^^^^^^^^^
Comparing a position and a key makes no sense.

You have to keep track of the position of the pivot element. See the
quicksort implementation in TFPList.Sort.

Mattias

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to