University of Lethbridge - CPSC
binary_search()
Assignment 1 - Movie2 - SM 25What is this function?
This function performs a binary search on the list of movies. It looks for a title by repeatedly cutting the list in half until it either finds the match or confirms that the movie isn’t there.
Just like in linear_search(), it:
Returns
trueif the title is found and stores the release yearReturns
falseif it’s not foundCounts how many comparisons it makes using the
comparisonsvariable/parameter
Members only
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 27 more lessons in University of Lethbridge - CPSC.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.