Watch linear and binary search work step by step. Understand when each algorithm shines β and when it doesn't.
Designed with the WJEC specification in mindSearch algorithms help computers find specific items in lists. Linear search checks every item one by one. Binary search is smarter β it keeps cutting the list in half, but only works on sorted lists!
Checks each element one by one from the start until the target is found or the end is reached.
Requirement: None β works on any array (sorted or unsorted).
When to use: Small arrays, unsorted data, or when the target is likely near the start.
Repeatedly halves the search space by comparing the target with the middle element.
Requirement: Array must be sorted first.
When to use: Large sorted arrays. Massively faster than linear for big data sets.