DEV Community

Discussion on: AN OUTSTANDING EXPOSITION OF THE "Big O" NOTATION

Collapse
 
aminmansuri profile image
hidden_dude

The binary search algorithm is simple.

Basically:

  1. choose the middle item, if that's the one, you're done!
  2. if it's less than the middle item, throw away the top half and go to 1.
  3. if it's more than the middle item, throw away the bottom half and go to 1.

Do this until you run out of an array.

The concept of Log N (base 2, also written Lg N sometimes) is to discard half your problem with each iteration.

For such cases you're problem will grow only logarithmically.

Thread Thread
 
aahil13 profile image
Onyeanuna prince

This is perfectly explained!!!
This is amazing 🤩