You have to write a function called push
that add integers to a Stack
according to the LIFO principle. You have then to code a function which sort the integer Stack
in ascending order.
The stack is defined by this structure:
struct stack { int data; struct stack* next; };
Examples of push :
push(s,3)
push(s,49)
push(s,-3)
After these calls, the stack contains [-3,49,3]
Hint : You can implement auxiliary functions (ex : pop, insert, empty, ...) to make the implementation easier.