Linear Search Algorithm with example | linear search in C | Data structures | hems hema

preview_player
Показать описание
Definition :
Linear search is a very simple search algorithm. In this type of search, a sequential search is made over all items one by one. Every item is checked and if a match is found then that particular item is returned, otherwise the search continues till the end of the data collection.

Algorithm:
Start from the leftmost element of arr[] and one by one compare x with each element of arr[]
If x matches with an element, return the index.
If x doesn’t match with any of elements, return -1.
Рекомендации по теме
welcome to shbcf.ru