Recursion

recursion code examples in swift language.

How to reverse an array using recursion ?

[Question] : Reverse array using recursion Example: [1,2,3] = [3,2,1]. Approach #1 using two variables : – // Approach#2: Using single pointer/variable so we written base case which blocks on n/2, we are just increasing the element by +1 on every recursion till half of the array.