Binary Search Help Repost.

Started by
21 comments, last by ????? ?????? 11 years, 9 months ago
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.
Advertisement
Facepalm.
Binary search works only with sorted lists.....
Sorry. I didn't really take a look at the algorithm.
thanks i benefited
smile.png

This topic is closed to new replies.

Advertisement