sort data on a stack, with a limited set of instructions, using the lowest possible number of actions
Try to use : ./push_swap -h "this command will show what to do "
The idea is simple, You have two stacks called Stack A and Stack B.
Stack A is given a random list of unorganized numbers.
You must take the random list of numbers in Stack A and sort them so that Stack A is organized from smallest to largest.
There are only a few moves you’re allowed to used to manipulate the stacks that we’re going to call “Actions”.
The main goal of this project is to organize Stack A in as few actions as possible.
the moves are named: sa, sb, ss, ra, rb, rr, rra, rrb, rrr, pa, pb.
I use Double linked list to implement these moves :
-swap 2 first element
-put the first element last,and all elemnt go UP by one
-put the last element First, so all elements go DOWN by ine element
-take the first element at the top of a stack and put it at the top of other_stack.
-Thanks to the checker program, you will be able to check if the
list of instructions you’ll generate with the program push_swap is
actually sorting the stack properly.