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.

Computer Science Introduction to Algorithms Recursion and Space Complexity Space Complexity

Logarithmic space referred to as logarithmic time?

Around 5:02 "Because of this, we say that the recursive version of the binary search algorithm runs in logarithmic time with a big O of log N."

Should this be "runs in logarithmic space"?

I think that's what the example is illustrating.

I think he just misspoke, but yeah I noticed the same thing.

2 Answers

Jordan Kittle
.a{fill-rule:evenodd;}techdegree seal-36
Jordan Kittle
Full Stack JavaScript Techdegree Graduate 20,138 Points

I also noticed this. I think it should have been talking about space complexity too. The subject he was talking about was space complexity and the video was showing extra memory requirements at the time.

Hi, as you noticed and learned the time complexity for a recursive binary search is O(log(n)) and its space complexity is also O(log(n)), because you will have to keep log(n) times right, left and array in the computer memory.

Hope this helped!