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]
3 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]3 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
You are working on a graphical app, which includes multiple different shapes. The given code declares a base Shape class with an
ycow [4]

Answer:

maybe

Explanation:

5 0
2 years ago
Which option is the default when creating appointments and meetings in a user’s own calendar as it relates to Free/Busy informat
Vlad1618 [11]

Answer:

C !

Explanation:

7 0
3 years ago
Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a ____ wh
mart [117]
Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a subdirectory whose records are filenames that point to files.
3 0
3 years ago
If a person is proactive, they do NOT have to be defensive.<br> True<br> False
Thepotemich [5.8K]
The answer is true for this question
6 0
2 years ago
Read 2 more answers
Help pls put them in order for me??
Natalija [7]

Answer: i can't see the hole thing?

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • The ____ shortcut keys remove character formatting. (points : 2) ctrl 0 (zero) ctrl i ctrl spacebar ctrl u
    8·2 answers
  • Which writing format is also beneficial to public speaking? a. Five paragraph essay c. Conventions b. Prose d. None of these
    5·2 answers
  • What are two fundamental components of data structures?
    10·1 answer
  • Which of the following is not an example of technological progress? A: new scientific knowledge that has practical applications
    12·2 answers
  • A beginning driver may tend to oversteer. This means the driver what? Btw Cars are technology so that is why it is under Compute
    11·1 answer
  • Write a function called missing_letters that takes a string parameter and returns a new string with all the letters of the alpha
    7·1 answer
  • What is the decrypted binary
    9·1 answer
  • Write a programme with C++ language wich print the biggest number in between three numbers , whith INT
    14·1 answer
  • Dominic list his camera for sale on an online auction site Chloe is the highest bitter and purchase as the camera how does the a
    14·1 answer
  • How many pages is 1500 words double spaced 12 font?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!