List all the steps used to search for 9 in the sequence 1,3,4,5,6,8,9,11 using linear search

Ramsey

Ramsey

Answered question

2021-02-02

List each step taken in the linear search to find 9 in the numbers  1,3,4,5,6,8,9,11 

Answer & Explanation

hesgidiauE

hesgidiauE

Skilled2021-02-03Added 106 answers

Your question is not at all clear in terms of the level of detail required or whether the procedures are to be carried out by a computer or a human. For example, do we need to include steps like "copy value X into memory register Y" or "go grab a sheet of paper to write on"? It's also not clear whether you just want a True or False returned or the position in the list.
But here's the basic procedure that you should be able to complexify as you require.
Check if 1==9. It does not.
Check if 3==9. It does not.
Check if 4==9. It does not.
Check if 5==9. It does not.
Check if 6==9. It does not.
Check if 8==9. It does not.
Check if 9==9. It does.
Return True.
The basic idea of linear search is to start at the beginning of the list and just keep going through it until you find the value you're looking for or run out of numbers in your list, whichever happens first.

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Discrete math

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?