loading...

Discussion on: Linear and Binary Search in JavaScript

Collapse
stephjs profile image
Steph Author

That's true, it depends on your data set. Assuming it's sorted and you're only worried about the run time of the search, a linear search is O(n) while a binary search is O(log n).