Wikisort - Wiki versus Grail Rotations

Wikisort - Wiki versus Grail Rotations

Musicombo

55 лет назад

2,122 Просмотров

Wikisort uses a different method of rotating items in an array compared to Grailsort. For those who haven't heard of "rotations" in sorting, this is a good source to check out: https://hackernoon.com/fun-with-array-rotations-add4a335d79a

Wikisort implements rotations using three reversals: one for both the left and right subarrays, and one final time for both subarrays combined. Grailsort, on the other hand, uses ranged swaps to "carry" over chunks of an array to different locations. Grail's strategy is a bit less intuitive but it's actually a very elegant piece of code and is much more efficient. In a best-case scenario, Grail's rotate method performs half the amount of swaps compared to Wiki's rotate method.

It turned out to be a significant improvement to the algorithm, so why not make a video about it? Enjoy!

Check out the program here: https://github.com/MusicTheorist/ArrayVisualizer
Visit the channel Discord here: https://discord.com/invite/2xGkKC2
Check out the Mother 1+2 Restoration project: https://discord.com/invite/ajQf9Ut
Ссылки и html тэги не поддерживаются


Комментарии: