https://github.com/archer-01/push_swap
Sorting algorithm based on two stacks
https://github.com/archer-01/push_swap
c problem-solving-algorithms stacks
Last synced: 3 months ago
JSON representation
Sorting algorithm based on two stacks
- Host: GitHub
- URL: https://github.com/archer-01/push_swap
- Owner: Archer-01
- Created: 2022-02-20T07:27:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-06T16:00:48.000Z (over 1 year ago)
- Last Synced: 2025-02-15T18:35:48.736Z (5 months ago)
- Topics: c, problem-solving-algorithms, stacks
- Language: C
- Homepage:
- Size: 271 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# push_swap
A sorting algorithm based on two stacks
## Main program
### Description
* **push_swap** is a program that takes a list of integers as input and sorts it in ascending order.
* The program prints the instructions used to sort the list of integers.
* The provided list of integers should have no duplicate numbers and should not surpass 4 bytes integer range.
* The program uses two stacks to sort the list of integers: Stack A and Stack B.
* The set of instructions **push_swap** might use is the following: **sa**, **sb**, **ss**, **ra**, **rb**, **rr**, **rra**, **rrb**, **rrr**, **pa** and **pb**#### Swap instructions
#### Rotate instructions
#### Reverse rotate instructions
#### Push instructions
### Usage
```sh
git clone https://github.com/Archer-01/push_swap.git
cd push_swap
make
```
```sh
./push_swap [list_of_integers]
```### Demo

## Bonus program
### Description
**push_swap** is associated with another program named
**checker*** The **checker** program takes a list of integers as input and checks if the list is sorted in ascending order.
* The program reads from standard input for instructions, if numbers get sorted the program prints **OK** followed by a newline, otherwise it prints **KO** followed by a newline.### Usage
```sh
git clone https://github.com/Archer-01/push_swap.git
cd push_swap
git checkout bonus
make bonus
```
```
./checker [list_of_integers]
```### Demo

[](https://forthebadge.com)