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
Which of the following shows the correct order of inventions that helped the first computers make calculations?
castortr0y [4]

Answer:

1st - Mechanical Relays, 2nd - Vacuum tubes, 3rd - Transistors

Explanation:

<em>From Tubes...</em>

<em />

The three main components of a basic triode vacuum tube.

The type of tube used in early computers was called a triode and was invented by Lee De Forest in 1906. It consists of a cathode and a plate, separated by a control grid, suspended in a glass vacuum tube. The cathode is heated by a red-hot electric filament, which causes it to emit electrons that are attracted to the plate. The control grid in the middle can control this flow of electrons. By making it negative, you cause the electrons to be repelled back to the cathode; by making it positive, you cause them to be attracted toward the plate. Thus, by controlling the grid current, you can control the on/off output of the plate.

Unfortunately, the tube was inefficient as a switch. It consumed a great deal of electrical power and gave off enormous heat—a significant problem in the earlier systems. Primarily because of the heat they generated, tubes were notoriously unreliable—in larger systems, one failed every couple of hours or so.

<em>...To Transistors</em>

<em />

The invention of the transistor was one of the most important developments leading to the personal computer revolution.The transistor was invented in 1947 and announced in 1948 by Bell Laboratory engineers John Bardeen and Walter Brattain. Bell associate William Shockley invented the junction transistor a few months later, and all three jointly shared the Nobel Prize in Physics in 1956 for inventing the transistor. The transistor, which essentially functions as a solid-state electronic switch, replaced the less-suitable vacuum tube. Because the transistor was so much smaller and consumed significantly less power, a computer system built with transistors was also much smaller, faster, and more efficient than a computer system built with vacuum tubes.

The conversion from tubes to transistors began the trend toward miniaturization that continues to this day. Today’s small laptop PC (or netbook, if you prefer) and even Tablet PC systems, which run on batteries, have more computing power than many earlier systems that filled rooms and consumed huge amounts of electrical power.

8 0
3 years ago
After which stage in the information processing cycle can data be referred for future use?
Sedbober [7]

Answer:

after the data storage stage, data is able to be referred to and use for future uses.

7 0
3 years ago
The company database may be stored on a central database server and managed by a database adminstrator true or false
RUDIKE [14]
The answer is True.  <span>The company database may be stored on a central database server and managed by a database administrator.  </span>
6 0
3 years ago
A radio and communications security repairer is responsible for both radio and satellite communication systems.
natita [175]
I'm almost certain the answer is true
3 0
3 years ago
Read 2 more answers
According to the Doppler effect, objects moving away from Earth would have a
Stells [14]
<span>According to the Doppler effect, objects moving away from Earth would have a redshift.  </span>A <span> redshift means that every wavelength becomes longer and if we observe Hydrogen lines that are at a certain position, those will become redshifted.</span>
7 0
3 years ago
Read 2 more answers
Other questions:
  • Create a class named Person that holds the following fields: two String objects for the person’s first and last name and a Local
    5·2 answers
  • What are the prime factorizations of 52 and 77? a. b.
    5·1 answer
  • When using Regedit to browse through the registry, the key that is highlighted is the ________, and its value entries are visibl
    5·1 answer
  • Create a program that generates a report that displays a list of students, classes they are enrolled in and the professor who te
    11·1 answer
  • A firm can survive and succeed in the long run if it successfully develops strategies to confront the _______________ that shape
    9·1 answer
  • in Python we use IDE ( lntegrated Dvelopment Environment ) to write down the program data points of difference between script mo
    13·1 answer
  • Who is famous for his three laws of robotics?
    9·1 answer
  • Can someone pls do a toradora,Mha or princess jellyfish rp I'm open for anyother rp's
    11·2 answers
  • What refers to a set of instructions executed in order?
    6·1 answer
  • What option can be used by a system administrator to ensure that dynamic updates are made only by known clients when you have a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!