The Push_swap project is part of the curriculum at 42, designed to test a student’s ability to manipulate stacks, implement efficient sorting algorithms, and manage constraints such as memory usage and execution time.
The goal of the project is to sort a list of integers using only a predefined set of operations on two stacks, a and b. The challenge lies in sorting the numbers with the fewest possible moves, demonstrating algorithmic efficiency.
he allowed operations are:
• sa: Swap the first two elements of stack a.
• sb: Swap the first two elements of stack b.
• ss: Perform both sa and sb at the same time.
• pa: Push the top element from stack b to stack a.
• pb: Push the top element from stack a to stack b.
• ra: Rotate stack a (shift all elements upwards, and the top becomes the last).
• rb: Rotate stack b.
• rr: Perform both ra and rb at the same time.
• rra: Reverse rotate stack a (shift all elements downwards, and the last becomes the top).
• rrb: Reverse rotate stack b.
• rrr: Perform both rra and rrb at the same time.
MIT License Copyright (c) 2024 Jérémy Lorette