Computer Science, asked by priyabadiger100, 1 year ago

What should be the output if the array [10,20,30,40,50] and the element to be searched 100 are passed as an argument to the Linear Search function?

Answers

Answered by 123oceans
1

since the integer value to be searched for (100) is not available in the array. variable (valid) can be used in the beginning to be declared as false. if searchitem = array(x) then valid = true. in this case valid = false meaning that the searchitem was not available in the array . therefore you should output a message stating that the item is not found.

example : in psedocode

if valid = false

then

   output " searchitem not found in array".

endif

Similar questions