Linear search is used to find the value of a target in a list.
Keep in mind that linear search is great for short lists but not great for dealing with large amounts of data because we search for one item at a time. Are
Apply Linear Search
Linear Search will start with the first element and check if it matches our target element, and until Search not found The search will continue.
The following is the list:
[45, 17, 23, -19, 43, 55, 72,
This is the side code for linear search as a method.
for each element in the search_list if element equal target value then print location and return index if element is not found then print message not found and return -1
Let's convert side code to Java!
1D linear search
We have given you
liner search class already