Skip to main content

Linear Search

Learn Linear Search (Searching, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Linear Search vs Binary Search Linear Search - O(n): checks every element one by one. Works on any array, sorted or not. Binary Search - O(log n): repeatedly halves the search range by comparing the middle element. REQUIRES the array to be sorted first.

More lessons in Searching