https://github.com/hamzaelkhatri/push_swap
The aim of this project is to sort data on a stack, with a limited set of instructions, using the lowest possible number of actions
https://github.com/hamzaelkhatri/push_swap
ai c push-swap quicksort sort
Last synced: 12 months ago
JSON representation
The aim of this project is to sort data on a stack, with a limited set of instructions, using the lowest possible number of actions
- Host: GitHub
- URL: https://github.com/hamzaelkhatri/push_swap
- Owner: Hamzaelkhatri
- Created: 2021-03-10T14:20:13.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-25T11:53:54.000Z (about 5 years ago)
- Last Synced: 2025-03-04T07:23:26.537Z (over 1 year ago)
- Topics: ai, c, push-swap, quicksort, sort
- Language: C
- Homepage:
- Size: 11.3 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# push_swap
sort data on a stack, with a limited set of instructions, using the lowest possible number of actions
## Concept of this Project ##
## Push_Swap Algorithm ::
Push_Swap Algorithm
The idea is simple, You have two stacks called Stack A and Stack B.
Stack A is given a random list of unorganized numbers.
You must take the random list of numbers in Stack A and sort them so that Stack A is organized from smallest to largest.
There are only a few moves you’re allowed to used to manipulate the stacks that we’re going to call “Actions”.
The main goal of this project is to organize Stack A in as few actions as possible.
## MOVES ##
the moves are named: sa, sb, ss, ra, rb, rr, rra, rrb, rrr, pa, pb.
I use Double linked list to implement these moves :
## sa || sb :arrows_clockwise: ##
-swap 2 first element
## :arrow_heading_up: ra || rb :arrow_right_hook: ##
-put the first element last,and all elemnt go UP by one

## :arrow_heading_down: rra || rrb :arrows_counterclockwise: ##
-put the last element First, so all elements go DOWN by ine element

## pa || pb :arrow_right: ##
-take the first element at the top of a stack and put it at the top of other_stack.

## Checker:
-Thanks to the checker program, you will be able to check if the
list of instructions you’ll generate with the program push_swap is
actually sorting the stack properly.
## This is how much instriction the algorithm Do with 100 random number

## To Test
Try to use : ./push_swap -h "this command will show what to do "
