Algorithm for Sequential Search or Linear Search

[4694 views]


What is Sequential Search?

Simple Sequential Search or Linear Search Algorithm

Sequential search is the natural searching algorithm which everyone follows in the Real life. Just go on checking the elements from fist to last. If the match is found, display that the element is found at that position else just display "Element not found"

Algorithm for Sequential Search or Linear Search

Step 1: Start Step 2: Take element to be searched as input from User in "search" variable and the elements in array a[] Step 3: Repeat until the last element of the array list Step 3.1 If search == current element in the list then, return current elements index value else continue with next iteration Step 4: Stop

Pseudocode for Sequential Search or Linear Search

Read size, array[size], search from user i = 0 WHILE i < size IF search == array[i] WRITE i break; ELSE i++ ENDIF ENDWHILE
        

Struggling to Understand Algorithm and Flowchart? Try our Notes



Want to Test Your Knowledge on Algorithm and Flowchart?


Other Notes you might be Interested in:




Comments



Search
Recommended Deals End in

Top Java Interview Questions PDF Guide with 30+ Pages



Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Quiz to Test Your Skills
Search Tags

    Pseudocode for Linear Search

    Pseudocode for Sequential Search

    Linear Search or Sequential Search Algorithm