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
Grace [21]
3 years ago
7

Why do Selection Sort and Insertion Sort’s outer loops run 11 iterations if there are 12 elements in the array?

Computers and Technology
1 answer:
laiz [17]3 years ago
3 0

Answer:

The final case in selection sort is trivially sorted.

The final iteration in insertion sort is not needed.

Explanation:

For selection sort, you make sub arrays and find the smallest element placing it in the front and repeat until sorted.  This guarantees the final element will already be the greatest element, thus it is trivially sorted.

For Insertion sort, you use the initial element and compare it to the previous element and swap if the current is larger than the previous.  Using this sort, you will always perform n-1 comparisons where n is the total amount of elements in the array.  Thus, there are only 11 iterations for a 12 element array.

Cheers.

You might be interested in
What refrigerant has been approved for new household refrigerators and freezers
Alexxx [7]
Bsbsnsnsnsn jajwjemoeododhdhdw whajsjshtzzvsssnxbba. 3
8 0
3 years ago
What is the body of scientific knowledge based on?
ANTONII [103]
It depend on all such as guess ,observation ,hypothesis and etc
3 0
3 years ago
Read 2 more answers
What is the preferences of occupation in ones life?
umka21 [38]

Answer:

mark me brai list i request u

6 0
3 years ago
PLEASE HELP<br>what are some benefits of using graphic on web page?​
qwelly [4]

Images help tell a story where describing with words is either too lengthy, or practically impossible. For instance, you could have a map of a location and various arrows and other markings to describe movements of troops during a battle of the civil war. This is one example of many that you could have as an image on a website. Describing the troop movements with words only may be really difficult to do. Plus many people are visually oriented learners, so they benefit with images every now and then. Of course, it's best not to overdo things and overload the site with too many images. A nice balance is needed.

5 0
3 years ago
Computer C’s performance is 4 times as fast as the performance of computer B, which runs a given application in 28 seconds. How
slamgirl [31]

Answer:

112

Explanation:

Since computer C's performance is 4 times faster, naturally I'd multiply 28 by 4.

6 0
3 years ago
Other questions:
  • What is an extrinsic value? A. something that is valuable in and of itself B. something that is valuable because it leads to ano
    12·1 answer
  • to the nearest millimeter a cell phone is 123 long and 54 mm wide what is the ratio of width to length
    12·1 answer
  • What was one of the first inventions that made it possible to communicate almost instantly?
    11·1 answer
  • You have a 20-bit network part and a 4-bit subnet part. How many hosts can you have per subnet?
    15·1 answer
  • Explain the SCAN disk scheduling algorithm. Explain why it is sometimes called the Elevator Algorithm.
    9·1 answer
  • Who is a second-degree contact on a professional networking profile?
    12·1 answer
  • From the Software Engineering Code of Ethics, which clauses relate to intellectual property (check all that apply)
    15·1 answer
  • PrimeFactorization.java: Write a program that begins by reading in a series of positive integers on a single line of input and t
    12·1 answer
  • Will give 5 star and the mark brainleist
    11·2 answers
  • Write algorithm and flowchart for the following<br>a.find the sum and average of any four numbers ​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!