Linear and binary search, bubble, insertion and merge sort, their pseudocode and time complexities, and when to use each.
Linear search
Checks each element in turn until the target is found or the list ends. Works on any list (unsorted). Worst case O(n).
`` found ← FALSE i ← 1 WHILE i <= n AND found = FALSE DO IF list[i] = target THEN found ← TRUE ELSE i ← i + 1 ENDIF ENDWHILE ``
Viewing only
This content is free to read on superexams.com and cannot be printed or downloaded.
Read the full note — free
Create a free account to read this note in full. Every free account gets 2 complete revision notes — no card needed.