Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add insertion_sort.csv #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add insertion_sort.csv #51

wants to merge 1 commit into from

Conversation

mowteam
Copy link

@mowteam mowteam commented Jan 4, 2022

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.

@d-albrecht
Copy link
Contributor

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.

@mowteam
Copy link
Author

mowteam commented Jan 7, 2022

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.

@d-albrecht
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants