Folders and files Name Name Last commit message
Last commit date
parent directory
View all files
Push_swap is a project about efficiently sorting a list of numbers with some constraints.
We have two stacks and the following commands at our disposal:
pb : push b - take the first element at the top of a and put it at the top of b
pa : push a - take the first element at the top of b and put it at the top of a
sa : swap a - swap the first 2 elements at the top of stack a
sb : swap b - swap the first 2 elements at the top of stack b
ss : sa and sb at the same time
ra : rotate a - shift up all elements of stack a by 1. The first element becomes the last one
rb : rotate b - shift up all elements of stack b by 1. The first element becomes the last one
rr : ra and rb at the same time
rra : reverse rotate a - shift down all elements of stack a by 1. The last element becomes the first one
rrb : reverse rotate b - shift down all elements of stack b by 1. The last element becomes the first one
rrr : rra and rrb at the same time
📶 "push_swap" executable will accept the numbers as arguments and will display the necessary commands to sort them.
You can’t perform that action at this time.