1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
maria [59]
3 years ago
14

Write the pseudocode for linear search, which scans through the sequence, looking for ν. Using a loop invariant, prove that your

algorithm is correct. Make sure that your loop invariant fulfills the three necessary properties.
Computers and Technology
1 answer:
zavuch27 [327]3 years ago
8 0

Answer:

1 for i = 1 to A.length

2 if A[i] = nu

3 return i

4 return NIL

Explanation:

Loop invariant:

At the start of each iteration of the for loop of lines 1-3, there is no j<i such that A[j]=ν.

Initialization:

At the beginning of the first iteration, we have i=1, so there is no j<i such that A[j]=ν.

Maintenance:

We fix i and assume there is no j<i such that A[j]=ν.

If A[i]=ν, then we return a value, so then there are no more iterations, so the property is preserved.

If A[i]≠ν, then there is no j<i+1 such that A[j]=ν, which is the desired property for the next step.

Termination:

The loop terminates either for i=A.length+1, or if ever we encounter A[i]=ν.

In the first case, then there is no 1≤j≤A.length such that A[j]=ν, and we are correctly returning NIL

In the second case, if we encounter some i such that A[i]=ν, we are correctly returning i.

You might be interested in
What is the single most important component of a computer? Central Processing Unit DIP Motherboard Chipset
Dominik [7]
The mother board it holds all of the storage
5 0
3 years ago
The processing power of a computing device is measured by its _____.
Scilla [17]

Answer:

china

Explanation:

8 0
3 years ago
Which technology concept uses computer resources from multiple locations to solve a common problem?
MrRa [10]
Sounds like you are talking about Grid computing. You can also say cloud computing since that is the buzz words nowadays, but cloud computing is a very general statement.
5 0
3 years ago
Read 2 more answers
When naming a file to upload into an assignment in blackboard, it is okay to use special characters?
tatiyna

No, you cannot name a file to upload into an assignment in Blackboard using special characters such as #, ~, @, $, %, &, *.

So therefore, the answer is False.

7 0
3 years ago
Most portable devices, and some computer monitors have a special steel bracket security slot built into the case, which can be u
Artemon [7]

Answer:

Instead of using a key or entering a code to open a door, a user can use an object, such as an ID badge, to identify themselves in order to gain access to a secure area. What term describes this type of object?

Explanation:

6 0
2 years ago
Other questions:
  • Which wildcat character will return a single character when using the find dialog box
    14·1 answer
  • Which is NOT a type of SD card?
    8·2 answers
  • For homework, we have to figure out what's in the picture. It's " too close to tell " but I can't figure out what it is. Any ide
    11·1 answer
  • Oxygen-18 has an atomic number of 8. How many neutrons are in this isotope?
    7·1 answer
  • Read each statement below. If the statement describes a peer-to-peer network, put a P next to it. If the statement describes a s
    12·1 answer
  • Which statement best describes desktop publishing?
    10·1 answer
  • Which company was the first to develop personal computers?
    6·1 answer
  • Whats the formatting of a letter to the editor?​
    12·1 answer
  • Hi who plays among us
    9·1 answer
  • What is HTML? Write some future of HTML.<br>follow for follow ​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!