Pseudocode and Algorithm for Sequential Search or Linear Search


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
Solution Worked 7 UpvotesUpvote
        
Solution Didn't Worked 1 DownvotesDownvote


Comments




Search