In this video , we are going to implement Linear Search using Python Lists .
Linear Search is the most standard searching algorithm which is
used for searching an element in an Array . However , that
element may or may not be present in an Array .
TIME COMPLEXITY :
BEST CASE : O(1)
AVERAGE CASE : O(N)
WORST CASE : O(N)
where N is the number of Elements in an Array .
ALGORITHM :
1. Take an array as an input .
2. INPUT the element you want to search in an array read it as “ item “ and initialize a variable count = 0 .
3. Now , we will match this item with each element of an array i.e A[i] , where A[i] is the element of array at i-th position , with the help of loop.
4. If A[i] gets equal to item , then set count=1 , FOUND
5. Else if i ) N and count=1 , then NOT FOUND
Practice coding problems : http://www.codeofgeeks.com/codingprob...
On this page of the site you can watch the video online Implementing the Linear Search in Python - using Python Lists with a duration of hours minute second in good quality, which was uploaded by the user CODE OF GEEKS 23 December 2018, share the link with friends and acquaintances, this video has already been watched 711 times on youtube and it was liked by 11 viewers. Enjoy your viewing!