matthewsamuel95 / ACM-ICPC-Algorithms

Algorithms used in Competitive Programming
2.07k stars 1.26k forks source link

Sorting Stack using recursion #998

Open pr4nshul opened 4 years ago

pr4nshul commented 4 years ago

Sort a given stack using recursion. In the recursive function use only basic functions of stack like push, pop etc. Input Format

First line contains the number of elements in stack , N. Next line contains N elements in stack from bottom to top. Constraints

0<N<10000 Output Format

Print the elements in sorted order from top to bottom.