Menu

#3 bug in mwFixedRecSort

open
None
5
2001-08-09
2000-11-29
Anonymous
No

In mwFixedREcSort line 295 :

procedure TM3Array.QuickSortEx(SorCompare: TMergeCompareEx);
var Left, Right, SubArray, SubLeft, SubRight:LongInt;
Temp, Pivot: Pointer;
Stack : array[1..32] of record First, Last : LongInt; end;

1..32 is way to small for sorting (ascending) a DArray of 100.000 elements if the DArray is in descending order.

(EAccessViolation with message 'access violation at address ....')

64 was ok for 100.000 elements, but gave problemns with
200.000 elements.

I think this array should be dynamic so it can grow as necessary in exceptional cases.

Tony.

Discussion

  • Ross Judson

    Ross Judson - 2001-08-09
    • assigned_to: nobody --> rossjudson
     
  • Nobody/Anonymous

    Logged In: NO

    No, it's not. The algorithm is flawed, as I already mailed
    once. The shortest sub-array should be sorted first,
    then you'll never need more than 2log(n) stack depth.

    Stephan Eggermont
    Sensus, systems that make sense

     

Log in to post a comment.