Our website loads in split second powered by Schema Theme. Thanks to MyThemeShop

Reversing an array using Recursion in Java

Reversing an array using Recursion is an example of Tail Recursion . We maintain two in-variants “i” and “j”. “i” holds starting element index  and “j” holds ending element index of the array. As long as “i” is less than “j”, we swap two elements starting and ending element of the array. Increment “i” and decrement “j” and solve the similar problem for the rest of the array until two in-variants “i” and “j” cross over. 

Algorithm or Recurrence relation for Reversing an Array

 Reversing an array using Recursion – Implementation in Java

Here is the impementation for Reversing an array using recursion in java

 Output