What is searching, and why do we do it?
Whenever we have lots of items, it’s important to be able to find the one we need. Examples of searching in everyday life include:
- Looking through a clothing rail to find an item in your size
- Searching through the spice rack to find the oregano amongst all the other spices
- Finding the trading card you need in a box of swaps
When working with data on a computer, we also need to be able to search to find items. For example, we might want to:
- Find the postal address of a business contact in a list of contacts
- Find the test results for a particular student
- Find an item on a shopping list or task list so that you can cross it off
This week we will be looking at well-known algorithms for searching data.
First, think about how you would instruct someone to find a book:
- On a randomly ordered bookcase in someone’s bedroom
- In the fiction section at a library
Would the instructions be the same in both cases? Discuss your thoughts in the comments.