About Lesson
Linear Search Algorithm
Let’s learn a simple algorithm called Linear Search. It is a straightforward way to find a particular value in a list. It checks each element in the list one by one until the desired value is found or the list ends.
Algorithm Steps
- Step 1: Start at the beginning of the list.
- Step 2: Compare the current element with the item to be searched, i.e., search target.
- Step 3: If the current element is the target value, return its position.
- Step 4: If the current element is not the target value, move to the next element in the list.
- Step 5: Repeat steps 2-4 until the end of the list is reached.
- Step 6: If the end of the list is reached and the target value is not found, indicate that the value is NOT FOUND in the list.