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
The remove() method in the Queue interface ________. Group of answer choices retrieves, but does not remove, the head of this qu
salantis [7]
<h2>Question:</h2>

The remove() method in the Queue interface ________.

A. retrieves, but does not remove, the head of this queue, returning null if this queue is empty

B. retrieves and removes the head of this queue, or null if this queue is empty

 

C. retrieves, but does not remove, the head of this queue, throwing an exception if this queue is empty

D. retrieves and removes the head of this queue and throws an exception if this queue is empty

<h2>Answer:</h2>

D. retrieves and removes the head of this queue and throws an exception if this queue is empty

<h2>Explanation:</h2>

In Java, the Queue interface is found in the java.util package and inherits from the Collection interface. It is used to store elements which are processed in the order in which they are inserted. This means that the first element will be processed first.

The Queue interface has many methods. Some of them are;

i. add(): allows elements to be added to the queue.

ii. remove(): retrieves and removes elements from the head of the queue. The head of the queue points to the first element of the queue. If the queue is empty, the remove() method throws an exception called the <em>NoSuchElementException</em>

<em />

iii. poll(): retrieves and removes the element at the head of the queue. Unlike the remove() method, if the queue is empty, a <em>null </em>is returned.

iv. peek(): retrieves but does not remove the element at the head of the queue. Just like the poll() method, a <em>null</em> is returned if the queue is empty.

7 0
2 years ago
a sign is to be hung from the end of a thin pole, and the pole supported by a single cable. your design firm brainstorms the six
Angelina_Jolie [31]
The correct answer for the question that is being presented above is this one: "C=F>D>A>B>E" <span>A sign is to be hung from the end of a thin pole, and the pole supported by a single cable. Based from the 6 images, the sequence of inequalities should be C = F > D > A > B > E</span>
4 0
3 years ago
The development team recently moved a new application into production for the accounting department. After this occurred, the Ch
Gnesinka [82]

Answer:

B

Explanation:

User Acceptance Testing (UAT) is the testing done by end users who is going to use that application. In these testing they will test  whether the application meets all the functional requirements of the end user. If it passed then only the application will move to the production. This will ensure that the application meets the user requirements before it put into the usage.

The Answer is B

5 0
3 years ago
________ is a hybrid version of Ethernet that uses either 10Base-T, 100Base-T, or 1000Base-T.
Vladimir79 [104]

Answer: ANSWER is B I'm pretty sure

Explanation: hope this help

s :)

7 0
3 years ago
In general, the pilot and _______ approaches are the most favored conversion approaches.
Karo-lina-s [1.5K]

Answer:

The correct approach is "Phased".

Explanation:

  • The pilot step requires just to validate the development's implementation goals and objectives and then when the SDMX objects were introduced to development, several perhaps all problems have indeed been detected as well as logged through so that they're being corrected either by the detailed technical advisory committee.
  • The staggered or phased approach towards deployment provides the time possible to obtain the very next knowledge on evaluation criteria, staff including diverse cultures such that the strategy produced could be customized accordingly.
6 0
2 years ago
Other questions:
  • What type of Windows Server is the most likely server to be targeted by a computer hacker?
    13·2 answers
  • Which sentence uses a pair of synonyms? Because there was so much shouting, many of the protestors began screaming in order to b
    6·2 answers
  • What is the output of the following program?
    9·1 answer
  • Briefly summarize two examples of cybercrime stories.<br> quick pleaseeee
    10·1 answer
  • Under the assumption that there exists an unknown Turing machine encodableinc1bits that decides3-SATis inO(n10) time, give imple
    7·1 answer
  • Enter key is also known as Return key. (True or false)
    13·2 answers
  • Identify traits of entrepreneurs. Check all of the boxes that apply.
    11·1 answer
  • Which term describes a visual object such as a picture a table or text box
    15·2 answers
  • If, after fetching a value from memory, we discover that the system has returned only half of the bits that we expected; it is l
    8·1 answer
  • Is Invader Zim gonna come back?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!