push_swap - README

push_swap

C project · sorting, optimization

Highly optimized sorting with two stacks and a tiny set of allowed operations.

The problem

Sort a stack of integers using a second stack and only 11 operations (swap, push, rotate, reverse rotate), in as few operations as possible.

What I built

The hard part

Computing the real cost of each candidate move, including when rotating both stacks together saves operations, and doing it fast enough to run for every element.

Built with

More projects