How to visually display changes in an array after sorting?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By poopfeast420

So I’ve got an array of values with an identifying node, so [5, nodeA][7, nodeB][4, nodeC] and so on. I have corresponding visual boxes that show the number + node name in each box but at the moment I just update the values in each box when the array gets sorted. I modify the values in the array, then sort it, then update the boxes. What’s a good way to move the boxes around after sorting?
At the moment, I have a previous, current, and next index on the visual nodes. The visual nodes have the current index match with the array. After changing and sorting the array, I go through the sorted array and find the matches in the visual nodes and update the previous index to have the current index, and current index having the matched index. And in theory, I would move the visual boxes to the current index position from the previous index. It doesn’t feel efficient, but I don’t know how I would incorporate this in the actual array sorting.

:bust_in_silhouette: Reply From: Inces

Wow that is complicated, I don’t get it :). Why didn’t You use dictionary isntead of array ? It sounds like it would be sollution to any of these kinds of problems