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
Who is the host in super monkey ball?
Savatey [412]

Answer:

Brian

Explanation:

3 0
3 years ago
Which of the following syntaxes displays a dialog box, causing the user to enter input text?
maks197457 [2]

Answer:

c. prompt(text[,default Input])

Explanation:

In javaScript the prompt() method displays a dialog box which allows the user input text required by the program.

5 0
3 years ago
While the economy of eastern Washington relies on farming, western Washington relies on technology.
Strike441 [17]
True- western Washington hosts modern technologies supporting both academic and co curricular activities
3 0
3 years ago
Read 2 more answers
You are able to drag a cell to a new location by pointing to the cell border until the pointer displays a _______ arrow, and the
ivann1987 [24]
I think its D, double-headed if I remember right. If this is brainiest can you mark it, please! I am trying to rank up. Thanks, hun!
7 0
3 years ago
Read 2 more answers
What makes this information systems environment unique? (3 points)
QveST [7]

Information technologies are unique not just because of their growing use in decision-making and knowledge management systems, important as that is. Their use has also yielded significant improvements in the efficiency of energy and materials use.

6 0
3 years ago
Other questions:
  • Sorry to bother you guys but for some reason it wont let me comment. How can i fix this?
    5·2 answers
  • You can use RWA to demonstrate how to do something special on the web, such as displaying articles found on websites that suppor
    15·1 answer
  • If you glare and grit your teeth while telling your friend that you're not frustrated, your nonverbal communication is _________
    6·1 answer
  • When solving for K, when cell potential is known, what is one of the first steps to follow?
    8·1 answer
  • A company is executing a strategy to encrypt and sign all proprietary data in transit. The company recently deployed PKI service
    10·1 answer
  • Help me plssssss which rule should be followed to stay safe online
    7·2 answers
  • Betty set up an account on a popular social networking website. she wants to know whether the privacy policy is effective for he
    14·1 answer
  • This is your code.
    9·1 answer
  • Help me i'll brainiest if its right
    7·2 answers
  • Many programmers think object-oriented programming is a superior approach to procedural programming. Others think it adds a leve
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!