Push swap
Description
Ecole 42 common core project.
It's about sorting numbers by using two stacks with set of rules. There are different commands:
ra rb rr - rotation move first number to the end of stack (stack A, stack B, both)
sa sb ss - swap first two numbers in stacks
rra rrb rrr - reverse rotation the same as rotation but another way
pa pb - push first number from stack to another
Goals:
- 3 numbers should be sorted less than 3 steps
- 5 numbers should be sorted less than 12 steps
- 100 numbers should be sorted less than 700 steps
- 500 numbers should be sorted less than 5500 steps
How to execute
- spell make
- spell ./push_swap 3 2 1 4 5 or ./push_swap "3 2 1 4 5"
- bash bench.sh to check algo
- ./push_swap $ARG | ./checker_Mac $ARG to check steps and final sorting.
- visualizer