Python L6 Searching
Python L6 Searching
Introduction to Python
Starter
• Think of a number between 1 and 100
• Can you think of a way to guess the number the
fastest?
• Try this with the person sat next to you.
Learning Objective Success Criteria
• Compare alternative • Use a linear search to find a
number
algorithms for a given
problem – using searches • Understand how a binary search
works
• Understand Random searches
Introduction to Python
Searching
Efficiency of code
• Which of these two search methods will result in the
least amount of processing?
• Is there a better way?
• How would you find an
item in a sorted list?
• How would you find
“Monkey” in the
dictionary?
Introduction to Python
Searching
Binary search
• How would you get a computer to guess a
number you were thinking of between 1 and 100?
Introduction to Python
Searching
Plenary
• How many types of Searches are there?
• Which one is the most efficient and why?
• In Binary searches, what is the maximum number of
tries it will take to guess a number that is between 1
- 1000