Explore

Searching Algorithms Flashcards
OCR GCSE J277 Computer Science specification
Ready to master these flashcards?
Sign in to study with spaced repetition and track your progress.
Sign In to Track ProgressTerms in this set (10)
Linear Search
A searching algorithm that checks each element in a list one by one until the target value is found or the end of the list is reached.
Binary Search
A searching algorithm that repeatedly divides a sorted list in half to locate a target value.
Prerequisite for Binary Search
The list must be sorted before performing a binary search.
Efficiency of Linear Search
Linear search is less efficient for large datasets as it checks each element one by one.
Efficiency of Binary Search
Binary search is more efficient than linear search for large datasets as it reduces the search space by half with each step.
Step 1 of Linear Search
Start at the first element of the list.
Step 2 of Linear Search
Compare the current element to the target value. If they match, the search is complete.
Step 3 of Linear Search
If the current element does not match the target, move to the next element and repeat until the target is found or the end of the list is reached.
Step 1 of Binary Search
Identify the middle element of the sorted list.
Step 2 of Binary Search
Compare the middle element to the target value. If they match, the search is complete. If the target is smaller, repeat the search on the left half. If larger, repeat on the right half.

Want to Learn More?
Get personalised lessons, quizzes, and instant feedback from your AI tutor.
Start Learning