Want to keep learning?

This content is taken from the Raspberry Pi Foundation & National Centre for Computing Education's online course, Programming 102: Think Like a Computer Scientist. Join the course to learn more.
A robot looking through five different dresses on a rail. A screen on the front of the robot says "SEARCHING..." and shows an image of a striped dress, matching one hung up on the rail.

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:

  1. On a randomly ordered bookcase in someone’s bedroom
  2. In the fiction section at a library

Would the instructions be the same in both cases? Discuss your thoughts in the comments.

Share this article:

This article is from the free online course:

Programming 102: Think Like a Computer Scientist

Raspberry Pi Foundation