'Coding has over 700 languages', '67% of programming jobs aren’t in the
technology industry', 'Coding is behind almost everything that is powered
by electricity'

Topics

You’re given a stack consisting of 'N' integers. Your task is to sort this stack in descending order using recursion.

We can only use the following functions on this stack S.

```
is_empty(S) : Tests whether stack is empty or not.
push(S) : Adds a 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 elements from the stack.
```

```
1) Use of any loop constructs like while, for..etc is not allowed.
2) The stack may contain duplicate integers.
3) The stack may contain any integer i.e it may either be negative, positive or zero.
```

Detailed explanation

```
1 <= 'T' <= 100
1 <= 'N' <= 100
1 <= |'V'| <= 10^9
Where |V| denotes the absolute value of any stack element.
Time limit: 1 sec
```

```
1
5
5 -2 9 -7 3
```

```
9 5 3 -2 -7
```

```
9 Is the largest element, hence it’s present at the top. Similarly 5>3, 3>-2 and -7 being the smallest element is present at the last.
```

```
1
5
-3 14 18 -5 30
```

```
30 18 14 -3 -5
```

```
30 is the largest element, hence it’s present at the top. Similarly, 18>14, 14>-3 and -5 being the smallest element is present at the last.
```