← BYTES
Algorithms·Starter·Ref: 12.1.6
What is linear search, and what is its worst-case time complexity?
Have a question about this video? Mention reference 12.1.6 when you contact us.
a.A tree traversal method; O(log n)
b.A sorting algorithm; O(n log n)
c.A way to compress an array; O(1)
d.Checking each element one by one until the target is found; O(n)
Linear search examines each element in sequence until it finds a match or reaches the end -- in the worst case (target absent, or at the very end) it must check all n elements, giving O(n), unlike binary search which requires a sorted array to achieve O(log n).
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES1216#Algorithms