I have an array of Integers. These Integers are actually indices of an array.
These indices point indirectly onto items. These Items have an ID. The *indices *should be sorted by this ID.
For a test, I have 4 Items with the IDs
But after sorting, the indices are
I’m pretty sure my Bubblesort is ok and does not have any errors.
Looks like this could potentially try to access an index greater than the length of the array. The first setarrayelem has an opportunity to set Item to array.get(arraylength), which is the element after the last element in the array. I tried implementing these nodes and blueprint would crash silently.
By comparing A with B, but swapping A with A+1 (which could be completely different index from B), I’m not sure the result is actually getting sorted.
And then you need to run the bubble sort repeatedly, because one pass of bubble sort won’t be enough.