heykamikaze / push_slap

Мой Калашников :) Optimized data sorting: with a limited set of instructions, using the lowest possible number of actions, sort ints into a correct order

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

push_slap

push_swap: Ecole42 project, the main goal is to get aquaintant with sorting alorithms. Ints on the stack are sorted with the limited set of instructions.

push_swap_bonus: tester that checks if the instructios offered by the user sort the ints entered.

Execution: ./push_swap

make

./push_swap *ints to sort*

img

Execution: ./checker

./checker *ints to sort*

*commands to exec

KO output means the commands haven't sorted the stack

OK output means the stack has been sorted

img

instructions Description
sa swap first two elements of stack A
sb swap first two elements of stack B
ss sa and sb at the same time
pa pops the first elememt on B and puts it on top of A
pb pops the first elememt on A and puts it on top of B
ra rotates stuck A up by one
rb rotates stuck B up by one
rr rotates both A and B up by one
rra rotates stuck A down by one
rrb rotates stuck B down by one
rrr rotates both A and B down by one

Graphic representation of sorting algorithm in progress:

gif

About

Мой Калашников :) Optimized data sorting: with a limited set of instructions, using the lowest possible number of actions, sort ints into a correct order


Languages

Language:C 96.5%Language:Makefile 3.5%