Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/medidbella/push_swap
This project involves sorting data on a stack, with a limited set of instructions, and the smallest number of moves.
https://github.com/medidbella/push_swap
sorting-algorithms stacks
Last synced: about 1 month ago
JSON representation
This project involves sorting data on a stack, with a limited set of instructions, and the smallest number of moves.
- Host: GitHub
- URL: https://github.com/medidbella/push_swap
- Owner: medidbella
- Created: 2024-03-26T02:27:26.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-04-26T08:16:49.000Z (10 months ago)
- Last Synced: 2024-11-12T03:37:10.916Z (3 months ago)
- Topics: sorting-algorithms, stacks
- Language: C
- Homepage:
- Size: 159 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---------------------------------------------------_PUSH-SWAP ?_-------------------------------------------------------
This project involves sorting data on a stack, with a limited set of instructions, and the smallest number of moves.
you have the right to use only two stacks and only theis instructoins :
SA (swap a): Swap the first 2 elements at the top of stack a. Do nothing if there is only one or no element.
SB (swap b): Swap the first 2 elements at the top of stack b. Do nothing if there is only one or no element.
SS: SA and SB at the same time.
PA (push a): Take the first element at the top of b and put it at the top of a.
PB (push b): Take the first element at the top of a and put it at the top of b.
RA (rotate a): Shift up all elements of stack a by 1 The first element becomes the last one.
RB (rotate b): Shift up all elements of stack b by 1 The first element becomes the last one.
RR : ra and rb at the same time.
RRA (reverse rotate a): Shift down all elements of stack a by 1 The last element becomes the first one.
RRB (reverse rotate b): Shift down all elements of stack b by 1. The last element becomes the first one.
RRR : rra and rrb at the same time.
the project will only print the minimum number of instructions to sort the stack 'a' in ascending order
-----------------------------------------------------------------------------------------------------------------------