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
Which of the following information sources was not directly affected by the Telecommunications Act of 1996?
VMariaS [17]
Apparently, the answer is newspaper publishing.

Since telecommunication is defined to use wireless and electrical protocols to transmit data.
6 0
4 years ago
You recently started working part-time in a retail store, and are learning about the reading devices your store uses.Your store
slega [8]

Answer:

Laser beams.

Explanation:

Recently, that user has began functioning part-time in such a retail outlet, as well as he discovering regarding his shop's learning tools. During checkout, his shop requires the code scanner to scan objects.  

The barcode scanner uses laser beam technologies because the laser beam is rapidly running over the QR code or barcode back-and-forth, or executing the sequence. The sensors well into the system display the mirrored beam patterns that decrypts the barcode.

So, the following are the reason that describes the answer is correct according to the scenario.

5 0
3 years ago
Which one of these is not a way of identifying that a website is secure?
FinnZ [79.3K]

Answer:

B

Explanation:

all url's begin with https://

5 0
4 years ago
18. The push rod connects to the _______, which is designed to pivot back and forth to open and close the valve.
spin [16.1K]
In an overhead valve engine, pushrods connect to A. rocker arm which pivots and opens valves
6 0
3 years ago
Read 2 more answers
Jill uses Word to create an order form. She starts out by creating a table that has three columns and ten rows. What should she
kifflom [539]
A is the best answer
I hope it’s work
5 0
3 years ago
Other questions:
  • What can you use with your keywords to narrow your search if you complete an internet search using a search engine and do not ge
    15·2 answers
  • Write the definition of a class Clock. The class has no constructors and three instance variables. One is of type int called hou
    13·1 answer
  • Which institution developed outside the limits of the written costitution of the united states ?
    14·1 answer
  • What is the purpose of the domain name​
    5·1 answer
  • Next, go to the mw_tour.html file. Within the document head, create links to the mw_layout.css and mw_styles.css style sheet fil
    10·1 answer
  • What is a written or electronic document that outlines etiquette policies for using networks and network resources?
    8·1 answer
  • The game often becomes stuck on landscape mode when tilting the device during gameplay, which cuts off some peripheral text. A w
    8·1 answer
  • Which type of appliance can host several functions, such as antimalware, firewall, content filter, and proxy server
    11·1 answer
  • What would a bar graph best be used for? State why and give 2-3 examples of things you could demonstrate with a bar graph
    5·1 answer
  • This site isn't letting me add my ans and wut should I do?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!