When using "Run X Sorts", duplicate elements could appear for seemingly no reason. This was caused by the sorting threads not setting the number of unique elements.
When the number of unique elements is larger than the array size (frequenty the case), this causes some elements to decrease by 1. This means that, on the typically-used linear distribution, duplicate elements often appear.
This is fixed by directly changing the array length slider, which not only auto-updates the uniques slider, but also makes the sliders properly update with the length change.
To achieve this, public methods are created in ArrayFrame.java, and the ArrayFrame instance is made publicly accessible.
When using "Run X Sorts", duplicate elements could appear for seemingly no reason. This was caused by the sorting threads not setting the number of unique elements.
When the number of unique elements is larger than the array size (frequenty the case), this causes some elements to decrease by 1. This means that, on the typically-used linear distribution, duplicate elements often appear.
This is fixed by directly changing the array length slider, which not only auto-updates the uniques slider, but also makes the sliders properly update with the length change.
To achieve this, public methods are created in ArrayFrame.java, and the ArrayFrame instance is made publicly accessible.