+ 1
odd bug in my binary search algorithim
i'm revisiting binary search, but have come into a particular bug - the length of the array is equal to 1 no matter what, and the algorithm can only properly find the value if it's the first or second value in the array. i've compared my other codes, but can't quite see the bug. could someone explain what i'm doing wrong? my code: https://code.sololearn.com/cRUyprqIPQeL
1 Antwort