Sir, why we had taken base case as arr.length-1 in the previous question of "whether an array is sorted or not "
and here we are taking base case as si==arr.length
Using Array Length in the base case
hi @pranavchoudharyy
here we are taking si==arr.length because we are checking for every index whether it contains the given data and last index is arr.length-1 so we can not stop there thats why base condition will be at arr.length.
1 Like
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.