I didn’t understand, why we are using index==-1 at first if statement?
Can I do it by storing the last data position to some new variable and then returning the the last index value ?
Why we are using index==-1?
It will start returning values when we hit our base case.
It is checking index si = 0 but before checking the index si=0 it checks the next index si =1 and so on till last index and when the recursion call ends it returns the index and if the index !=-1 and the element is found then it returns si.