Searching
As we stated previously, searching an array is looking to see whether a particular value exists within an array and if so, which index it’s located at. Let’s see how many steps the search operation takes for an array if we were to search for "dates".
When you and I look at the shopping list, our eyes immediately spot the "dates", and we can quickly count in our heads that it’s at index 3. However, a computer doesn’t have eyes, and needs to make its way through the array step by step.
To search for a value within an array, the computer starts at index 0, checks the value, and if it doesn’t find what it’s looking for, moves on to the next index. It does this until it finds the value it’s seeking.
The following diagrams demonstrate this ...