Std::sort and std::stable_sort visualizer in Luau

You know those annoying sorting algorithms that you had to learn in programming courses? Well suddenly I have found them really interesting, and I even needed to implement a stable sort a while back because table.sort is unstable. I didn’t want to go all out making Timsort because that’d be a massive waste of my time considering I only want to sort only a few hundred items at most so std::stable_sort will do! I made introspective sort for fun.

I sorted the numbers 1 to 800.

std::sort

The quicksort uses a median of three pivoting.

Based on this video

Yes it has heapsort!

std::stable_sort


Based on this video

2 Likes