Computer Science, asked by dikshitakalita943, 1 month ago

Write an algorithm to search for given ITEM in a given X[n] using linear search technique.​

Answers

Answered by belcy1918
2

Answer:

1. LB=0

2. Repeat steps 3 and 4 until LB>UB //UB means Upper Bound(length of array)

3. If ARR[LB]==ITEM then { pos=LB break }

4. LB=LB+1

5. if LB>UB then

print "Value Not Found"

else

{

//Second part swapping of searched item at top of the array

temp=ARR[pos]

ARR[pos]=ARR[0]

ARR[0]=temp

}

Similar questions