Quick Start Guide
This guide will get you from zero to sorting stacks with Push Swap in just a few minutes.Build the Program
Compile the program using the provided Makefile:This compiles all source files and creates the
push_swap executable.Run Your First Sort
Sort a simple list of numbers:Output:These operations will sort the numbers in ascending order!
Try Different Examples
Two Numbers
Already Sorted
Larger Input
Understanding the Output
Each operation manipulates one or both stacks:Swap Operations
sa, sb, ss - Swap top two elementsPush Operations
pa, pb - Move element between stacksRotate Operations
ra, rb, rr - Shift all elements upReverse Rotate
rra, rrb, rrr - Shift all elements downCommon Use Cases
Testing with Random Numbers
Generate random input using shell commands:Counting Operations
See how many operations are needed:Input as a String
You can also pass numbers as a single quoted string:./push_swap 3 2 1.
Next Steps
Learn the Algorithm
Understand how the Turkish algorithm works
Operations Reference
Detailed documentation of all operations
More Examples
See comprehensive usage examples
Error Handling
Learn about input validation
Need Help?
- Check Basic Usage for detailed command syntax
- Review Installation if you had build issues
- Visit the GitHub repository for the source code