💻 Computer Science · Topic 36 of 97

Searching Algorithms

Searching algorithms find an item in a list, using linear search or the faster binary search on sorted data.

▶ Interact

Play with the controls to see the idea in action.

Loading animation…

📘 Learn

Searching algorithms find an item in a list, using linear search or the faster binary search on sorted data.

  • Linear search checks one by one
  • Binary search halves the list each time
  • Binary search needs sorted data

🧠 Quick quiz

Three questions. Score 2 or more to complete the topic.

What is Searching Algorithms?

Within Computer Science, which covers algorithms, programming, data, networks, hardware and safe, responsible use of technology, this topic explains Searching Algorithms. Computing topics explain how software, hardware and data work, with diagrams and models that show each step in order.

Check that you can explain Searching Algorithms in your own words and give one example from everyday life. If you can do that, you have understood the core idea.

Understanding Searching Algorithms helps you design, test and explain programs, websites and systems, from small projects to exam questions.

Searching Algorithms in detail

Linear search checks each item in a list one by one from the start until it finds the target or reaches the end. It works on unsorted data but is slow for large lists, as it may check every item.

Binary search works only on sorted data. It looks at the middle item and eliminates half of the remaining list each time, depending on whether the target is higher or lower, repeating until found. For a list of 1,000 items, it needs at most about 10 checks, versus up to 1,000 for linear search. Choosing a search method depends on whether the data is sorted and its size.

How the interactive helps you understand Searching Algorithms

Watch the sorting process in the interactive. Use any sliders or buttons it offers to change the values and see how the sorting process responds.

Before you change anything, predict the result. Then change one value at a time and check whether your prediction was right. This is a quick way to build a correct mental model of Searching Algorithms.

Real-life uses and examples

Common mistakes to avoid

Frequently asked questions about Searching Algorithms

What is Searching Algorithms?

Searching algorithms find an item in a list, using linear search or the faster binary search on sorted data.

What are the most important points about Searching Algorithms?

The main points are: Linear search checks one by one; Binary search halves the list each time; Binary search needs sorted data.

Why is Searching Algorithms useful?

Understanding Searching Algorithms helps you design, test and explain programs, websites and systems, from small projects to exam questions.

How can I practise Searching Algorithms?

Open the interactive at the top of this page and change the controls one at a time. Predict the result before each change, then take the three-question quiz. A score of two or more marks the topic as complete on this device.

Which topics are related to Searching Algorithms?

Related topics in Computer Science include Recursion, Programming Languages, Introduction to HTML.

← PreviousTypes of Programming ErrorNext →Sorting Algorithms

Keep exploring Computer Science