This document outlines a linear search algorithm to find an item in a list by checking each location in order until the item is found or all locations have been checked. The algorithm initializes an index variable to 1, sets a found variable to False, checks if the item is at the current index location, if found it outputs "found", if not it increments the index and repeats the check until the end of the list, if never found it outputs "not found".
1 of 1
Downloaded 17 times
More Related Content
Linear search
1. False
Input search
item
Set
Index to
1
While
Set found
to False
If
Location index
Found = True
True
False
If Found
Output not
found
Output Found
True
False
True
False
Re-arrange the Linear
Search algorithm into
the correct sequence
Start
Stop