This project has been created as part of the 42 curriculum by aezzirar.
Because Swap_push doesn’t feel as natural
push_swap is an algorithmic project whose goal is to sort a stack of integers using a very limited set of operations and the smallest possible number of moves.
The program receives a list of integers as arguments, stores them in stack A, and outputs a sequence of instructions that will sort the stack in ascending order. A second stack (stack B) is available as additional storage.
The main challenge of this project is not only to sort the numbers, but to do so efficiently, by choosing and implementing appropriate algorithms depending on the input size.
This project focuses on:
- Algorithmic thinking
- Time and operation complexity
- Data structures
Run make in the root directory to compile the push_swap program.
If you want to compile the bonus checker program, run make bonus.
./push_swap [list of integers]Peers ;)
YouTube
Reddit
DeepSeek
AI was used in the following ways:
Brainstorming algorithm approaches; to explore different sorting strategies suitable for two-stack constraints.
Debugging assistance; to identify edge cases and memory issues during development.
Code review suggestions; to improve code structure and readability.
All AI-generated content was reviewed, tested, and understood before integration.