Conversation
|
When I'd read the title I really wasn't sure how you would visualize a sorting algo on a cone shaped tree. But I really forgot about the color "dimension". Great approach. The flashing - despite being described - caught me a bit off-guard in the beginning, but you quickly understand how it works. Only the confirmed sorted portion flashes. I guess with your code bases (assuming there is code behind that, who would create this by hand) you could add other sorting algos to have comparison, too, if you wanted, as long as they are in-place ones. |
|
Thanks, my one worry is the flashing might be a bit overwhelming. I wrote methods for selection sort and bubble sort as well but found insertion was the most discernible and looked the best. |
|
Well, the flashing can definitely be a bit distracting especially if you try to comprehend what's going on in the way that it starts to flash right after the order was achieved and similarly right after the flashing is done, the next ordering loop starts. There aren't any phases where you could look at the tree for a moment and realize for yourself "this loop is done, now it should flash". It just flashes right away. You could improve this aspect if you wanted. But that doesn't devalue the whole animation, it's still a nice sorting visualization after all. |
The animation breaks the tree into bins in the z-direction and fills the bins with random rainbow colors. Then, the bins are sorted using insertion sort. Each time a loop is completed in the insertion sort process, the sorted portion of the tree flashes white twice. The tree then rotates the colors once the sorting is complete.