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
hodyreva [135]
3 years ago
13

Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[

1]. Then find the second smallest element of A, and exchange it with A[2]. Continue in this manner for the first n − 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 first n − 1 elements, rather than for all n elements? Give the best–case and worst–case running times of selection sort in Θ–notation.
Computers and Technology
1 answer:
krek1111 [17]3 years ago
7 0

Answer:

1. create the first array A

2. create the second array A1, the same length as array A.

3. create a loop to iterate over both arrays for a number of times specific to the length of the arrays, with a condition to get and pop only the minimum value of which arrays for every loop.

4. save both items to "a" for minimum value A and "b" for minimum value A1.

5. call a function to push the "a" variable value to A1 and "b" variable value to the array A.

Explanation:

This code would interchange the values of both arrays, the best-case scenario for the code is O( n ) where n is the number of items in both arrays and worst is the best-case multiplied by the number of time to compare all the items with the minimum value.

You might be interested in
What is the difference between spyware and adware?
Sati [7]

Answer:

It's C

Explanation:

Adware displays or directs the users to an advertisement, while spyware performs espionage on the computer`s activity.

8 0
3 years ago
Read 2 more answers
Which of the following strategies will help you to stay focused and on topic while writing your essay?
AveGali [126]

Answer:

the answer is D,both A and B

8 0
3 years ago
Read 2 more answers
Which protocol below is used to email clients to send email
AVprozaik [17]

The Internet Message Access Protocol (IMAP) is a mail protocol used for accessing email on a remote web server from a local client. IMAP and POP3 are the two most commonly used Internet mail protocols for retrieving emails

4 0
3 years ago
How does tracking changes relate to sharing a workbook in Excel?
ElenaW [278]

Answer:When you highlight changes as you work, Excel outlines any revisions (such as changes, insertions, and deletions) with a highlighting color. On the Review tab, click Track Changes, and then click Highlight Changes. Select the Track changes while editing. This also shares your workbook check box.

Explanation:

8 0
2 years ago
Rupali is creating a database of all of the clients who request custom artwork. Each client will be considered one item in the d
Evgen [1.6K]
Data helperrrrrrrrrrrrrr
7 0
3 years ago
Read 2 more answers
Other questions:
  • Alicia is a dietitian. She gives other people suggestions for nutrition. She wants to organize a large amount of data concerning
    13·1 answer
  • What is being measured using kbps, mbps, and gbps?
    7·1 answer
  • Please help me please and thank you!
    14·1 answer
  • RDBMS stands for_________________
    12·1 answer
  • Identify at least three body language messages that project a positive attitude?
    15·1 answer
  • A computer lab has two printers. Printer I handles 40% of all the jobs. Its printing time is Exponential with the mean of 2 minu
    8·1 answer
  • Create the Following Menu in a loop so the menu will continually show until the user chooses to exit.AddMultiplyExitAdd a value
    10·1 answer
  • Which of the following can be represented by a single binary digit?
    14·1 answer
  • A large computer software firm promised a client that it could deliver a new operating system on a tight deadline and put Keith
    10·2 answers
  • Write a short note on Ms - Excel...​..
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!