https://github.com/faruktinaz/push_swap
This project will make you sort data on a stack, with a limited set of instructions, using the lowest possible number of actions. To succeed you’ll have to manipulate various types of algorithms and choose the most appropriate solution (out of many) for an optimized data sorting.
https://github.com/faruktinaz/push_swap
push-swap push-swap-42 push-swap42 pushswap sorting sorting-algorithm sorting-algorithms
Last synced: 6 months ago
JSON representation
This project will make you sort data on a stack, with a limited set of instructions, using the lowest possible number of actions. To succeed you’ll have to manipulate various types of algorithms and choose the most appropriate solution (out of many) for an optimized data sorting.
- Host: GitHub
- URL: https://github.com/faruktinaz/push_swap
- Owner: faruktinaz
- Created: 2023-05-09T20:23:09.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-07T13:33:15.000Z (over 2 years ago)
- Last Synced: 2025-04-14T14:14:43.705Z (6 months ago)
- Topics: push-swap, push-swap-42, push-swap42, pushswap, sorting, sorting-algorithm, sorting-algorithms
- Language: C
- Homepage:
- Size: 443 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# push_swap %125
This project will make you sort data on a stack, with a limited set of instructions, using
the lowest possible number of actions. To succeed you’ll have to manipulate various
types of algorithms and choose the most appropriate solution (out of many) for an
optimized data sorting.
The possible actions are:
- pa (push A): Take the first element at the top of B and put it at the top of A. Do nothing if B is empty.
- pb (push B): Take the first element at the top of A and put it at the top of B. Do nothing if A is empty.
- sa (swap A): Swap the first 2 elements at the top of stack A. Do nothing if there is only one or no elements.
- sb (swap B): Swap the first 2 elements at the top of stack B. Do nothing if there is only one or no elements.
- ss: sa and sb at the same time.
- ra (rotate A): Shift all elements of stack A up by 1. The first element becomes the last one.
- rb (rotate B): Shift all elements of stack B up by 1. The first element becomes the last one.
- rr: ra and rb at the same time.
- rra (reverse rotate A): Shift all elements of stack A down by 1. The last element becomes the first one.
- rrb (reverse rotate B): Shift all elements of stack b down by 1. The last element becomes the first one.
- rrr : rra and rrb at the same time.