Algorithms and Data Structures · Junior · Question 30 of 75
What is linear search?
- 1Jumping straight to the element using its hash
- 2Repeatedly halving a sorted array around its middle
- ✓Correct answer: Checking elements one by one until the target is found
Explanation
Linear search works on any array, sorted or not, and costs O(n) in the worst case. indexOf, includes and find all do linear search.