Hacker News new | past | comments | ask | show | jobs | submit login

    return min + (max - min) / 2
Oh, you want a random number?



Or in O(1):

  return min
Alternatively

  return max


> Or in O(1)

You mean in one instruction? The parent comment is O(1). The methods in the article are all O(1) too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: