/Push_Swap

Sort algorithme

Primary LanguageC

🔀 push_swap 📈

platform: osx 10.14.x language: c 42 login: mathmart

A sort algorithm using two stacks with a limited set of instructions.

🏗️ Compile

To compile programs:

make

To compile push_swap program:

make push_swap

To recompile programs:

make re

To clean all *.o in project and libraries:

make clean

To clean all *.o and compiled things in project and libraries:

make fclean

▶️ Run

Run push_swap:

./push_swap <number_1> <number_2> <number_3> ... <number_n>		(Numbers should be between INT_MIN (-2147483648) and INT_MAX (2147483647))

Then write actions into STDIN. When terminated press CTRL+D to write EOF. The checker will display if numbers are correctly sorted.

Run push_swap and check if the algorithm sort numbers correctly:

ARG="<number_1> <number_2> <number_3> ... <number_n>" ; ./push_swap $ARG | ./checker $ARG

Visualize:

With random values: python3 pyviz.py `ruby -e "puts (-200..200).to_a.shuffle.join(' ')"`

This is o-reo's visualizer, check his work: Visualizer repository.

🖥️ 42 Mark: 42-project-mark

⚖️ Copyright

Mathis Martini (mmartini42) © 2022