Computer Science, asked by Anonymous, 9 months ago

✍️✍️✍️✍️⤵️


Sort a stack using recursion (python)


➡️ valid answer only pls. ​

Answers

Answered by santhoshkalam19
2

your answer is here buddy...

Use of any loop constructs like while, for..etc is not allowed. We can only use the following ADT functions on Stack S:

is_empty(S) : Tests whether stack is empty or not.

push(S) : Adds new element to the stack.

pop(S) : Removes top element from the stack.

top(S) : Returns value of the top element. Note that this

function does not remove element from the stack.

Example:

Input: -3 <--- Top

14

18

-5

30

Output: 30 <--- Top

18

14

-3

-5

hope this will help you

Similar questions