Linear Search Flashcards

1️⃣ Familiarise yourself with the flashcards:

  • Look through all the flashcards to see what's on both sides.
  • Make sure you understand the information on each card. If something's unclear, click the link to the revision notes at the bottom of the page for more details.

2️⃣ Test yourself:

  • Look at the question or prompt on each card and try to remember the answer before flipping it over.
  • Check the answer and make a note of any cards you find challenging and need to go over more.

3️⃣ Consistently Review and Practice:

  • Use spaced repetition: spend more time on the cards you struggle with and go over them more often.
  • Regularly review all the flashcards to help you better understand and retain the information over time.

Note: We may include questions that have multiple correct answers. It's useful to remember specific examples to understand these concepts better.

PERSONALISED 1-TO-1 TUTORING

Need more help on this topic? Get 1-to-1 support

Get support with clear explanations, practice and feedback (Ages 5 to 16).

  • DBS-checked tutors
  • Flexible times
  • Parents can be updated

Want an ad-free experience? Subscribe to remove ads

What is a linear search?

A simple search that checks each item in a list in order to find a target.

How does a linear search work, step by step?

Start at the first item. Compare it to the target. If it matches, return the position. If not, move to the next item. Repeat until found or the end.

Does a linear search need the list to be sorted?

No. It works on unsorted or sorted lists.

What does a linear search return when it finds the item?

The position (index) of the item in the list.

What does a linear search do if the item is not in the list?

It reports that the item is not found.

In the best case, how many comparisons does a linear search make?

One, if the first item matches.

In the worst case, how many comparisons does a linear search make?

The same as the number of items in the list.

What is the time complexity of linear search?

Linear time, written as O(n).

What is one advantage of linear search?

It is easy to code and works on any list.

What is one disadvantage of linear search?

It can be slow on large lists.

If a value appears more than once, which one does linear search usually find?

The first match it meets in the list.

In the list [3, 8, 5, 2], how many comparisons does linear search make to find 5?

Three, because it checks 3, then 8, then 5.