Linear Search

There are teo types of searching  are there :-

1)    Linear Search (Sequencil Search)

2)    Binary Search

Linear Search

For the Searching procedure following possible answer

1.) Serarching is not successful element is not found,

2.) Return the index of the search element (Searching is Sucessful) in a linear search or the sequesntial search element enter by the and it will compare to first element of the list this comparison process is continue till either element is found or end of the list.

Element List are 5 , 20 , 25, 89 , 90 , 10.

Search Element is 10

I)                   10 == 5

II)                10 == 20

III)              10 == 25

IV)             10 == 89

V)               10 == 90

VI)             10 == 10

Searching successful.

Element present on 6th position.

Complexity Of Linear search algorithm

  • Linear search provide complexity for finding an element in an array because linear search is a step-by-step process, in which specific element is compared with each element of array.
  • In linear search complexity is due to two cases.
  • It is possible that required element occurs at the end of the array. So linear search consumes more time.
  • It is also possible that required element is not present in the given array, this is the worst case.
  • In this case the algorithm requires f(n)=n+1 comparisons.
  • If the element is at first position in array then only one comparison will be needed
Share

About the Author

Akash Padhiyar

Visit Website

2 Comments

  1. Thanks for your nice experience to share with us. Really awesome article with plenty of informative things to be known for us.

  2. Really love all the posts you offer! I am so looking forward to seeing more like them..

Leave a Comment

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.