linear and binary search code Flashcards

1
Q

linear using a loop

A

function searchItem(dataItem)
count = 0
while count < 50
if dataArray(count) == dataItem then
return(count)
endif
count = count + 1
endwhile
return(-1)
endfunction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly