This project involves sorting data on a stack, with a limited set of instructions, and the smallest number of moves. Acquiring the skills to manipulate various sorting algorithms and choose the most appropriate solution(s) for optimized data sorting is essential.
- This project is implemented in c and is compilable with a Makefile.
- Memory leaks free, Memory leaks are not to be tolerated.
- Error free, an error displayed in case something went wrong.
- The program takes a list of numbers to be sorted.
- The program has two stacks;
a
andb
, initiala
is full andb
is empty. - There is only a limited set of instruction possible (swap a, swap b, swap a b, push a, push b, rotate a, rotate b, rotate a b, reverse rotate a, reverse rotate b, reverse rotate a b).
- The program implements a sorting algorithm.
- The program displays the smallest list of instructions possible to sort the stack a, the smallest number being at the top.
- Stack b is always empty at the end of the program.
- 100 random numbers can be sorted in under 700 instruction.
- 500 random numbers can be sorted in under 5500 instruction.
- As a bonus, An extra checker program is implemented that can reads instruction and displays OK if the numbers are sorted, KO otherwise.
- LIFO Behavior
- Algorithmic Thinking
- Sorting Concepts
- State Management
- Operation Simulation
- Complexity Awareness