Find First index of array using recursion
F irst Index (recursive) Problem Description : Given an array of length N and an integer x, you need to find and return the first index of integer x present in the array. Return -1 if it is not present in the array. Sample Input: 5 (Size of array) 1 4 -1 3 4 (The array elements) 4 (x) Sample Output: 1 How to approach? Doing this iteratively is trivial. All we need to do is to start a loop from the 0th index to the end of the array. If we encounter ‘x’, then we return the index we’re currently on. If the whole loop is finished and we didn’t return any value, that means ‘x’ is not present on the array, so we return -1. We can do the same process recursively. Let’s create a function that returns an integer and takes in the following parameters: 1. The array itself 2. x 3. A start index (initially 0) Now, we will check whether the value element at index ‘start’ is equal to ‘x’. If yes, then we straight-away re...