Linear search algorithm (Linear Search)

Linear Search is a very basic search algorithm. In this type of search, a continuous search operation takes place through every element. Each element is checked and if any connection is found, that particular element is returned; If not found, the search process continues until the data is searched.

Linear Search is a very basic search algorithm. In this type of search, a continuous search operation takes place through every element. Each element is checked and if any connection is found, that particular element is returned; If not found, the search process continues until the data is searched.

images 1 of Linear search algorithm (Linear Search)
Images 1 of Linear search algorithm (Linear Search)

Linear search algorithm

 Gi ả i thu ậ t t ì m ki ế m tuy ế n t í nh  (  M ả ng A , Gi á  tr ị  x )  B ướ c  1 : Thi ế t l ậ p i th à nh  1  B ướ c  2 :  N ế u i  >  n th ì  chuy ể n t ớ i b ướ c  7  B ướ c  3 :  N ế u A [ i ] =  x th ì  chuy ể n t ớ i b ướ c  6  B ướ c  4 : Thi ế t l ậ p i th à nh i  + 1  B ướ c  5 :  T ớ i b ướ c  2  B ướ c  6 : In  ph ầ n t ử  x  đượ c t ì m th ấ y t ạ i ch ỉ  m ụ c i v à  t ớ i b ướ c  8  B ướ c  7 : In  ph ầ n t ử  kh ô ng  đượ c t ì m th ấ y B ướ c  8 : Tho á t 
 B ắ t  đầ u h à m linear_search  ( list ,  value ) for  m ỗ i ph ầ n t ử  trong danh s á ch  if  match item  ==  value  return  v ị  tr í  c ủ a ph ầ n t ử  k ế t th ú c  if  k ế t th ú c  for  k ế t th ú c h à m 

To find out the full code deployment for Linear Search in C language, please click on chapter: Linear search in C

According to Tutorialspoint

Previous article: Queue data structure (Queue)

Next article: Binary Search algorithm (Binary Search)

5 | 1 Vote
« PREV : Binary Search...
Queue data structure... : NEXT »