Linear Search Pseudocode

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Program start

output(“enter size of array”)

N = output(“enter size of array”)

FLAG = 0

I=0

A[] = N

output(“enter array elements”)

loop I from 0 to N-1

A[I] = output(“enter array elements”)

output(“which element do you want to find”)

Y = output(“which element do you want to find”)

loop I from 0 to N-1

if A[I]=Y

FLAG=1

Break

end loop

if FLAG=1

output(Search successful)

else

output(not found)

Program end

You might also like