## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

# I am stump on what is the complexity and Big O notation within this algorithm

In the video for binary search the worst case scenario is the target '8' but that means big O notation would be O(log 8) given n=8. Also since this is binary search it will have logarithmic time in the worst case scenario. Yet while loop shows as follows

''' while first <= last: midpoint = (first + last)//2 '''

Is divide by two but in the list for the midpoint is at 4 is that why we divide by two? Also how can the while loop be constant time and logarithmic time together in the same condition? I hope this isn't a confusing question, but any explanation could help.

Thanks!