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.
What is linear search (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 algorithm (Linear Search) Picture 1
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
Algorithm model for linear search
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
You should read it
- Binary Search algorithm (Binary Search)
- Interpolation Search algorithm (Interpolation Search)
- Gradient - color linear transformation in CSS
- Google is about to update the new search algorithm
- FORECAST function - The function returns a value along a linear trend in Excel
- Search algorithm by width
- Panda 4.0 algorithm was updated by Google on May 20, 2014
- Deep search algorithm
- TREND - The function returns values in a linear trend in Excel
- Google changed the search ranking algorithm, limiting the display of fake news
- Greedy Algorithm (Greedy Algorithm)
- Is Google's Helpful Content Algorithm Really Helpful?