Closed Ibozz91 closed 2 years ago
this happens because ArrayV internally uses an array of size 32768 (unless you change it via command prompt when starting the program) so these sorts actually write out of bounds for every size, but you usually don't notice it because the array is actually bigger
On 2048 numbers, you should notice warnings being printed to the console.
I think that there should be warnings instead of errors on higher numbers.
There are warnings on sizes below the max because the out-of-bounds index actually exists, but on max size it's truly out of bounds and there is an error.
Whether warning or error, you'd probably need all sorts to access the array by "proxy" (since if they access it directly, the array would act as if it was max size).
Personally, I think it should always error, but that would break the problematic sorts.
I think that there should be warnings instead of errors on higher numbers.
I actually disagree. Accessing out-of-bounds memory is a serious problem. In languages without Java's safety precautions, it leads to undefined behavior. Algorithms that have this issue should straight up be fixed without question.
Okay. this sounds good. The sorts so far I have had problems with the psuedo-heap and grail sort.
I found same problem in Binary Merge sort, something wrong in Highlights:
Hope this will help.
Yeah, though it's mainly the sort's fault: once low
or high
reaches the end of its subarray, it just sits there and still gets highlighted (Highlights doesn't have a check for out-of-bounds)
...wow those screenshots take up a lot of space lol EDIT: I put your screenshots in collapsible sections to not make the message so long, sorry!
Related: #60
If sorts attempt to highlight out-of-bounds indices, the request to highlight is ignored. Attempting to write to out-of-bounds indices is still an error, however. This was such an easy fix, I have no clue why we didn't do it before.
Some sorts are attempting to access indice 32768 on 32768 numbers, which is out of bounds. This does not happen on 2048 numbers.