This repository consists of the code samples, assignments, and notes for the Java data structures & algorithms + interview preparation bootcamp of WeMakeDevs.
Location of the code file: "lectures/10-binary search/code/src/com/kunal/InfiniteArray.java"
This question is covered in video #15 [Binary Search Interview Questions - Google, Facebook, Amazon] , question 5 [ time stamp : 1:28:00]
Error:
The code throws "java.lang.ArrayIndexOutOfBoundsException" error if the index of target value is greater than the mid value
For instance :
If given array = {3, 5, 7, 9, 10, 90, 100, 130, 140, 160, 170}
and target = 100 or any value after 130
but works fine if target is any value less than 90
Request:
I do not know how to fix this, I tried using chatgpt, but it does not help.
I Reckon the error is due to Condition given for while loop in line 17.
Location of the code file: "lectures/10-binary search/code/src/com/kunal/InfiniteArray.java" This question is covered in video #15 [Binary Search Interview Questions - Google, Facebook, Amazon] , question 5 [ time stamp : 1:28:00]
Error: The code throws "java.lang.ArrayIndexOutOfBoundsException" error if the index of target value is greater than the mid value
For instance : If given array = {3, 5, 7, 9, 10, 90, 100, 130, 140, 160, 170} and target = 100 or any value after 130 but works fine if target is any value less than 90
![Screenshot from 2024-01-16 17-45-08](https://github.com/kunal-kushwaha/DSA-Bootcamp-Java/assets/119693639/8297219f-6c3c-4c99-9633-172678f363dc)
Request:
I do not know how to fix this, I tried using chatgpt, but it does not help. I Reckon the error is due to Condition given for while loop in line 17.