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
Copyright ownership analysis starts with this principle: The ________ is the owner.
pogonyaev

Answer: Author

Explanation: self explanatory

3 0
3 years ago
Betty removed a web page from her website. Some users were browsing on her website. One of them clicked on a particular link and
Fittoniya [83]
To prevent users from seeing error pages and ensure that they have a pleasant experience in your application you can add the customErrors element to your Web.config file.  <span>Handling error codes and exceptions by the web.xml, you can configure </span>error-page elements<span> that act upon some error-code or exception-type.</span>
4 0
4 years ago
Consider the following code snippet: int count = 0; int[][] numarray = new int[2][3]; for (int i = 0; i &lt; 3; i++) { for (int
inna [77]
I have never seen this in my life sorry
7 0
3 years ago
What is a packet?
sleet_krkn [62]

Answer:

A

Explanation:

A packet is a set of data or information.

7 0
3 years ago
The MIQ inventory measures how much you value status. What are measures of status?
Alina [70]
When we're taking about measures of status, we're talking about either a socioeconomic perspective or something else. When we're talking about a socioeconomic perspective of status, there are two important measures. One would be social standing of a person and the other would be his economic standing. 
3 0
4 years ago
Other questions:
  • PYTHON CODE ONLY:
    7·1 answer
  • You want to find information about Paris, France in the last five years, written in English. What is the best way to search for
    5·2 answers
  • PLEASE HELP
    9·2 answers
  •  In which part of a professional email should you try to be brief, but highly descriptive? 
    10·1 answer
  • True/False? In association rule learning, the following two rules will always have the same support value.
    9·1 answer
  • DEFINE TRANSLATORY MOTION.<br>​
    15·1 answer
  • 20 points!!
    7·1 answer
  • Antivirus is a program that detects error.True or False.​
    9·1 answer
  • What steps can you take to secure your private information?.
    8·1 answer
  • (Brainliest!!)<br><br> How do i get rid of a headache?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!