University of Lethbridge - CPSC
Showing Search Results to the User
Assignment 1 - Movie1 - SM 25What does this function do?
This function runs a search and prints out the result in a clean, consistent way. When the user searches for a movie, this function:
Runs either the linear or binary search function (Depending on what is passed in it)
Tells the user if the movie was found
Shows the release year (if found)
Displays how many comparisons were made
It does not perform the search logic itself. It simply calls the correct search function and prints the outcome.
Why do we need this function?
Both linear search and binary search give back the same kind of results:
Found or not
Matching year (if found)
Number of comparisons
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.