Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMartin Owaga Mboya
13,595 PointsRecursive Binary Search
Why does he not subtract one from the length of the list like he did in the previous video?
1 Answer
Mark Sebeck
Treehouse Moderator 38,297 PointsHi Martin. Great question. In the binary search video he wanted to find the position of the last element in the list. Because lists start at 0 the position is going to be the number of elements - 1. (if there are 10 elements they will be 0 to 9). In this video he just wants to check if the list is empty. He's not looking for the last element. He knows if the length equals 0 then the list is empty. Hope this helps Martin.