← Back
Implement linear search algorithm.
Given an array of integers, do linear search on it.
Algorithm
Linear Search:
Iterate through the array from start to end.
For each element, check if it matches the target value.
If found, return the index or indicate success.
If not found after the loop, indicate failure.
Time Complexity
Linear Search:
O(n), where n is the number of elements in the array.
Array Elements
Enter numbers separated by commas
Target Value
Linear Search