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
MaRussiya [10]
3 years ago
11

2.2-2 Consider sorting numbers stored in array by first finding the smallest element n A of and exchanging it with the element i

n . Then find the second smallest A AOE1 element of A, and exchange it with . Continue in this manner for the firs AOE2 1 elements of A. Write pseudocode for this algorithm, which is known as selection sort. What loop invariant does this algorithm maintain? Why does it need to run for only the firs elements, rather than for all elements? Give the best-case n 1 n and worst-case running times of selection sort in ‚-notation.
Computers and Technology
1 answer:
True [87]3 years ago
7 0

Answer:

Follows are the explanation of the choices:

Explanation:

Following are the Pseudocode for selection sort:                      

for j = 0 to k-1 do:

      SS = i

      For l = i + 1 to k-1 do:

        If X(l) < X(SS)

          SS= l

        End-If

      End-For

      T = X(j)

      X(j) = X(SS)

      X(SS) = T

    End-For

Following are the description of Loop invariants:

The subarray  A[1..j−1] includes the lowest of the j−1 components, ordered into a non-decreasing order, only at beginning of the iteration of its outer for loop.  

A[min] is the least amount in subarray A[j.. l−1] only at beginning of the each loop-inner iterations.                      

Following are the explanation for third question:

Throughout the final step, two elements were left to evaluate their algorithm. Its smaller in A[k-1] would be placed as well as the larger in A[k]. One last is the large and medium component of its sequence because most and the last two components an outer loop invariant has been filtered by the previous version. When we do this n times, its end is a repetitive, one element-sorting phase.

Following is the description of choosing best-case and worst-case in run- time:

The body the if has never been activated whenever the best case time is the list is resolved. This number of transactions are especially in comparison also as a procedure, that will be (n-1)(((n+2)/2)+4).    

A structure iterator at every point in the worst case that array is reversed, that doubles its sequence of iterations in the inner loop, that is:(n−1)(n+6) Since both of them take timeΘ(n2).

You might be interested in
Q1: Which of the following is an input peripheral device?
faltersainse [42]

Answer:

Mouse

Explanation:

Input devices allow users to input something in the computer. For example keyboard allows users to type on the computer, or mouse allows users to click.

On the other hand output devices allow computers to output data. For example speakers allow us to hear the outputs of a computer.

3 0
3 years ago
Read 2 more answers
History of computer from difference engine <br>​
harkovskaia [24]

Answer:

Charles Babbage (1791-1871), computer pioneer, designed two classes of engine, Difference Engines, and Analytical Engines. Difference engines are so called because of the mathematical principle on which they are based, namely, the method of finite differences.

Explanation:

4 0
2 years ago
Read 2 more answers
A small amount of memory stored on the central processor for easy access is called
expeople1 [14]

The answer is : Cache.  It is a small amount of memory stored on the central processor for easy access.  Cache is where active data are placed for easier access, it stores recently used information so that it can be quickly accessed at a later time. Some types of cache are browser cache, disk cache, memory cache, and processor cache.

3 0
3 years ago
Read 2 more answers
____ formatting is automatically updated if you change data in the worksheet.
andriy [413]

Answer:

<u>Conditional</u> formatting is automatically updated if you change data in the worksheet.

Explanation:

Conditional formatting can be described as a tool that allows users to format a particular cell or a group of cells. The formatting also changes for any data being changed in the sheet.

A particular cell can have up to three format conditions and these conditions will be applied automatically to any changes entered in the cell. The conditional formatting also has the option to highlight the important cells.

4 0
3 years ago
The Harrison Group Life Insurance company computes annual policy premiums based on the age the customer turns in the current cal
valina [46]

Answer:

yea that is correct hope this works

7 0
3 years ago
Other questions:
  • Which method of deleting files can be used in windows xp and vista?
    12·1 answer
  • What is the name of the computer through which e-mail messages are sent and received?
    12·1 answer
  • When forced distribution is used to reduce leniency bias, this can cause __________ if a pfp system is in place?
    10·1 answer
  • A presentation has bullet points that move. The presenter wants to use these bullet points in several other places in the presen
    6·1 answer
  • What is up with the bots? They are so annoying.
    9·2 answers
  • Python: Bad input on line 8. What is the fix, please can someone tell me I’m desperate?
    10·1 answer
  • What is the missing line of code? &gt;&gt;&gt; &gt;&gt;&gt; math.sqrt(16) 4.0 &gt;&gt;&gt; math.ceil(5.20) 6
    14·2 answers
  • Which option is typically only used when utilizing self joins?
    8·1 answer
  • What would a good digital citizen do if he sees his classmate left her email account open on a school computer by mistake?
    11·1 answer
  • The technologist has recorded the red cell morphology as macrocytic. which mcv value would confirm this observation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!