This project has been created as part of the 42 curriculum by wkrati.
- Built with: C
- Focus: Stack-based sorting, algorithms, and optimization under constraints.
- What I learned: Problem solving, operation minimization, edge-case handling, and algorithmic thinking.
The push_swap project is an algorithmic challenge whose objective is to sort a stack of integers in ascending order using a restricted set of operations.
The program takes a list of integers as command-line arguments, stores them in stack A, and outputs a sequence of instructions that sorts the stack while minimizing the number of operations, in accordance with the project rules.
make./push_swap 4 67 3 87 23Example with randomly generated values:
ARG=$(shuf -i -1000:1000 -n 100 | tr '\n' ' ')
./push_swap $ARGmake fclean- 42 official push_swap subject
- Unix manual pages:
man writeman mallocman free
- Stack data structures and linked lists
- Sorting algorithms and optimization strategies
AI tools were used as a learning assistant to:
- Clarify algorithmic concepts and constraints
- Assist in reasoning about edge cases and debugging
- Support understanding of optimization strategies
All code was written, tested, and validated manually by the student, in compliance with the 42 curriculum rules.