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
rewona [7]
4 years ago
8

Given an list of N integers, Insertion Sort will, for each element in the list starting from the second element: Compare the ele

ment with the previous element If the previous element is greater than the element in question (EIQ), push the index of the previous element up 1 Repeat step two with the element before the previous element, and so on. Once an element has been reached that is less than the EIQ, stop pushing and insert the EIQ into the spot ahead of this element (or at the beginning of the list, if it is reached instead).

Computers and Technology
1 answer:
Elena L [17]4 years ago
8 0

Answer:

def insSort(arr):

ct=0;

for i in range(1, len(arr)):

key = arr[i]

j = i-1

while j >=0 and key < arr[j] :

arr[j+1] = arr[j]

j -= 1

ct=ct+1;

arr[j+1] = key

return arr,ct;

print(insSort([2,1]))

Output of the program is also attached.

You might be interested in
Assignment 4: Evens and Odds<br><br><br> How do I fix this?
skelet666 [1.2K]

There's definitely something wrong with your for loop. Try this:

for x in range(n):

You might want to check if all your print statements are correct. You might be missing just a period and it will be counted wrong.

6 0
3 years ago
You are working on a group project in which each member is required to collaborate on the write up the group wants to see what e
777dan777 [17]

Answer:

Track Changes?

Explanation:

5 0
2 years ago
Which elements are visible when a user opens a new PowerPoint presentation?
Mariulka [41]

Answer:

The only element visible is the presentation itself.

Explanation:

All of the other options, such as presenter's assistance, is hidden away from the projector, presentation device, etc. You are the only one that can see the window that shows what slide is next, presenter's notes, etc. <u>In other words, whatever you want the audience to see, that is only what they will see and nothing else.</u>

3 0
3 years ago
Read 2 more answers
The binary number represented by the voltage graph below is
ozzi

Answer:

The binary number represented by the voltage graph is bits

Explanation:

7 0
3 years ago
Best location to install a patch panel?
sergejj [24]

Answer:

Explanation: In general, there are three positions for the patch panel to install in the stand column of rack, which depends on your cabling. When adopting ground outlet, the cables usually enter inside the rack from its bottom. So the patch panel should be mounted in the lower part inside the rack.

8 0
3 years ago
Other questions:
  • Which passage form the passage best contributes to elisa impatient tone
    8·1 answer
  • Which of the following statements about computer graphics formats is true?
    14·1 answer
  • Harrison works in a manufacturing unit and oversees the logistics, including the daily shipping of a large number of packages. W
    12·2 answers
  • What type of file is MyFile.dll?
    14·2 answers
  • oftware that is free and whose code can be accessed and potentially modified by anyone is referred to as _____. shared source fi
    11·1 answer
  • 8. Why is it important not to download pictures to your school or workplace network if you do not plan to use them?
    10·1 answer
  • Codehs dartboard 3.12.4
    9·1 answer
  • Which of the following represents a backup system that will aid in recovery for any type of disaster or disruption?
    8·1 answer
  • Who made computer ? Which year?
    13·2 answers
  • He was called "The father of computing c_______ B_______​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!