Push_swap is a simple algorithm project, you have to sort Data. You have an int set of values, two communes and a set of Instructions for dealing with both. You should use the minimum possible instructions.
| Operaciones | Explicación |
|---|---|
| sa | swap a - swap the first two elements above stack a. |
| sb | swap b - swap the first two elements above stack b. |
| ss | swap a and swap b 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 - Moves all the elements in the stack up a one position, the first element becomes the last. |
| rb | rotate b - Moves all the elements in the stack up b one position, the first element becomes the last. |
| rr | ra and rb at the same time. |
| rra | reverse rotate a - Moves down all stack elements to a position, the last element becomes the first. |
| rrb | reverse rotate b - Moves down all stack elements to b position, the last element becomes the first. |
| rrr | rra and rrb at the same time. |
Max 3 operaciones.
Max 12 operaciones.
| Operaciones | Puntos |
|---|---|
| Menos de 700 | 5 |
| Menos de 900 | 4 |
| Menos de 1100 | 3 |
| Menos de 1300 | 2 |
| Menos de 1500 | 1 |
| Operaciones | Puntos |
|---|---|
| Menos de 5500 | 5 |
| Menos de 7000 | 4 |
| Menos de 8500 | 3 |
| Menos de 10000 | 2 |
| Menos de 11500 | 1 |
The bonus should only be made if the mandatory part is 100%. The bonus consists of developing a program called checker , which will verify if your A stack is sorted. For this you must send as arguments the numbers of the stack and once the program is executed you must send it the operations that you want to perform to order. When we want to stop sending operations we will do 'Ctrl + D'' and the checker will tell us "OK" if it is ordered or "KO" if it is not. The checker’s error checking must be the same as in push_swap