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
In the __________ Standard, chemical manufacturers, importers, and distributors are required to provide hazard information by wa
STatiana [176]

Answer is C: Hazard Communication

Hazard Communication Hazard (HCS 2012) provides a coherent and standardized approach to communicating the hazards of chemicals by way of Safety Data Sheets (SDSs) and labels on containers. However, Occupational Safety and Health Administration (OSHA) revised its HCS 2012. In it, they revised criteria for classification of chemical hazards, labeling provisions, hazard statements, and precautionary statements.  In addition, modifications were made to health standards substances to ensure requirements for labels and SDSs are consistent with the HCS 2012. According to OSHA’S standards, SDSs should periodically be reviewed and updated.

7 0
3 years ago
Read 2 more answers
What is included on the HP PC Hardware Diagnostics 3-in-1 USB Key that allows you to recover systems that cannot boot?
algol13

Answer:

HP PC Hardware Diagnostics UEFI

Explanation:

The 3-in-1 HP PC Hardware Diagnostics UEFI USB Key helps the client distinguish potential software, hardware, and Operating System issues. Both older and newer HP Desktop and Laptop PCs come with this tool installed. By default, it operates outside the OS to detach equipment issues from other system issues. In the event you do not have it pre-installed, you can get it from the official HP site.

3 0
3 years ago
Analyze the error in the html code :<br><br> HTML
Andrei [34K]

Answer:

The World Wide Web Consortium provide a simple online tool (https://validator.w3.org/) that automatically check your HTML code and point out any problems/errors your code might have, such as missing closing tags or missing quotes around attributes.

Explanation:

your question is not clear

hope it helps

6 0
3 years ago
Công dụng của đồng hồ đo điện:vôn kế, ampe kế, oát kế
Lostsunrise [7]

Answer:

I wonder what are you saying?

Explanation:

Please give me brainliest :)

4 0
3 years ago
What type of device is the printer?
ICE Princess25 [194]

B,the printer only receives signals from the computer and prints them.

4 0
3 years ago
Read 2 more answers
Other questions:
  • ou work as network administrator for an organization that has a Windows-based network. You want to use multiple security counter
    10·1 answer
  • PLZZZ HELP 30 POINTS!!
    14·1 answer
  • How do you change your age on here? I accidentally put that i was 15 but i am only 13. How do I change this?
    12·1 answer
  • The company currently runs 60 autonomous APs and has plans to increase wireless density by 50% in the near future
    13·1 answer
  • Whic flag has a special role in debuging
    6·1 answer
  • Match each role to the corresponding web development task.
    14·1 answer
  • What is the output of the following program? If there is any problem, how can
    13·1 answer
  • Which of these five are Netflix Originals?1/5
    5·1 answer
  • Help plz (will give brainliest)
    9·1 answer
  • What starts with p and ends with orn
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!