Algorithms and Data Structures: Linear Search

vasilevskialeks

Aleksandar Vasilevsk

Posted on March 3, 2020

Algorithms and Data Structures: Linear Search

As the name says a linear search is a process that starts at the beginning of a list and goes through every element (one item at a time) until it finds the element which is looking for. To find the element which is searching for (for example we are searching for x), a linear search algorithm is comparing every element in the list with the value inside of x, until a match is found or the whole list has been searched. Performance for using linear search in large lists is bad because it makes at most n comparisons, where n is the length of the list. In practice, linear search algorithm is rarely being used because other search algorithms like the binary search algorithm allow significantly faster searching for all but shortlists.

Continue reading...

💖 💪 🙅 🚩
vasilevskialeks
Aleksandar Vasilevsk

Posted on March 3, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related