JS Linear Search
Sequentially checks the target value in given list and match found.
Time Complexity:
best : O(1)
Worst: O(n)
Space Complexity: O(1)
function linearSearch(arr, target) {
for (let i in arr) {
if(arr[i] === target) return i;
...
vkglobal.hashnode.dev1 min read
Saleh Mubashar
Web Developer
Nice post, Kindly check out mine too thanks