Given a stack, sort it in ascending order (with the smallest elements on top) using only recursion.
{
"stack": [
5,
1,
0,
2,
4
]
}[
0,
1,
2,
4,
5
]{
"stack": [
34,
3,
31,
98,
92,
23
]
}[
3,
23,
31,
34,
92,
98
]{
"stack": [
1,
2,
3,
4,
5
]
}[
1,
2,
3,
4,
5
]Sign in to Run Code and Submit