Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Binary Search Help Repost.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
22 replies to this topic

#21 rip-off   Moderators   -  Reputation: 8516

Like
0Likes
Like

Posted 29 June 2012 - 05:32 AM

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.

Sponsor:

#22 szecs   Members   -  Reputation: 2173

Like
0Likes
Like

Posted 29 June 2012 - 05:48 AM

Facepalm.
Binary search works only with sorted lists.....
Sorry. I didn't really take a look at the algorithm.

#23 drgham   Members   -  Reputation: 105

Like
1Likes
Like

Posted 29 June 2012 - 10:23 AM

thanks i benefited
Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS