Sort Stack Recursion, is a Stack related problem and in this post we will see how we can solve this challenge in C++

sort the stack using only recursion and stack in built methods During recursion keep popping data in each recursive call now when moving from bottom we call another function which takes the current stack and starts popping the element till we get in a sitution when the stack top is smaller than the current data element ,so we place the data element and end the recursive call for it and return to the main recursive call

in each step if are just placing the element in its correct position in the stack

Please check the main.cpp snippet for the solution.

This solution originally posted at: Github by @susantabiswas