ellendb
07-08-2004, 04:01 AM
Dear list,
i try to sort a vector using the sort(Vec_IO_DP &arr) function (in Visual C++) as described in the book on page 337, section 8.2. It works fine for vectors with size smaller than 7. I understand that the M constant as declared in the sort algorithm is set to 7 for some memory/execution purpose.
If I use an array with size 7 or more, I get the error below in the else part of the if (ir-1<M) part, more exactly when I execute the rule istack[jstack] = ir; just after the test if (ir-i+1 <= j-1).
ERROR MESSAGE: Unhandled exception, access violation.
I need to sort a vector of which I do not know the size in advance. How can I do this?
Thanx,
Ellen
i try to sort a vector using the sort(Vec_IO_DP &arr) function (in Visual C++) as described in the book on page 337, section 8.2. It works fine for vectors with size smaller than 7. I understand that the M constant as declared in the sort algorithm is set to 7 for some memory/execution purpose.
If I use an array with size 7 or more, I get the error below in the else part of the if (ir-1<M) part, more exactly when I execute the rule istack[jstack] = ir; just after the test if (ir-i+1 <= j-1).
ERROR MESSAGE: Unhandled exception, access violation.
I need to sort a vector of which I do not know the size in advance. How can I do this?
Thanx,
Ellen