5. Approach for recursive problems #

Created Saturday 28 December 2019

To solve a recursive problem

Q) We have been given an integer array and a number ‘x’. We need to find the first index of the occurence of ‘x’, if it is present. Otherwise return -1. A) We can do both tail recursion and head recursion. But as we need to find the ‘first’ occurrence. Hence we are better off with tail recursion.