Binary Search Help Repost.
Your for loop doesn't make any sense in the context of the algorithm. You're not iterating over the array - you're leapfrogging over portions of it. The key observation is that the value of "i" is irrelevant in the loop body. Unless you just want to do something N times, this is a sign that something is amiss.
Facepalm.
Binary search works only with sorted lists.....
Sorry. I didn't really take a look at the algorithm.
Binary search works only with sorted lists.....
Sorry. I didn't really take a look at the algorithm.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement