An open API service indexing awesome lists of open source software.

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.

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.

![ezgif com-video-to-gif (1)](https://github.com/faruktinaz/push_swap/assets/114104599/8d2e9528-df8a-4298-8f2d-8e16e69332b3)

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.