https://github.com/ugolinolle/push_swap
📤 • Efficient stack sorting using limited operations in push_swap.
https://github.com/ugolinolle/push_swap
42 push-swap push-swap42
Last synced: 2 months ago
JSON representation
📤 • Efficient stack sorting using limited operations in push_swap.
- Host: GitHub
- URL: https://github.com/ugolinolle/push_swap
- Owner: UgolinOlle
- License: mit
- Created: 2023-12-03T11:34:02.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-29T08:15:58.000Z (about 1 year ago)
- Last Synced: 2025-03-03T06:44:46.028Z (7 months ago)
- Topics: 42, push-swap, push-swap42
- Language: C
- Homepage:
- Size: 127 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Push_swap
![]()
## 📝・Description
Push_swap is a sorting algorithm project that challenges you to sort a stack of integers using a limited set of operations. The goal is to implement an efficient sorting algorithm that uses the fewest possible moves to sort the stack.
## 🎯・Objectives
- Implement a sorting algorithm using two stacks
- Minimize the number of operations used to sort the stack
- Understand and apply algorithm complexity concepts
- Improve problem-solving skills and C programming proficiency## 🛠・Usage
### Compilation
```bash
make
```### Running the program
```bash
./push_swap
```### Example:
```bash
./push_swap 2 1 3 6 5 8
```## 🔍・Available Operations
- sa: swap the first two elements of stack a
- sb: swap the first two elements of stack b
- ss: perform sa and sb simultaneously
- 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 (first element becomes last)
- rb: rotate stack b (first element becomes last)
- rr: perform ra and rb simultaneously
- rra: reverse rotate stack a (last element becomes first)
- rrb: reverse rotate stack b (last element becomes first)
- rrr: perform rra and rrb simultaneously## 📊・Performance Benchmarks
- For 100 random numbers: < 700 operations
- For 500 random numbers: < 5500 operations## 🧑🤝🧑・Contributing
Contributions to this project are welcome. If you find any issues or want to improve the code, please feel free to open a pull request or issue.
## 📑・License
This project is licensed under the [MIT License](https://github.com/UgolinOlle/push_swap/blob/master/LICENSE) - see the LICENSE file for details.
## 📩・Contact
If you have any questions or would like to collaborate, please do not hesitate to contact me at [email](mailto:hello@ugolin-olle.com) or [LinkedIn](https://linkedin.com/in/ugolin-olle)