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
What do we call the distribution and access of illegal copies of digital books??
Maru [420]
That concept is piracy


3 0
3 years ago
Read 2 more answers
Create a program that has at least three classes. The class with main. A class that defines a Name (first name, middle name, and
Bond [772]

Answer:

See attached file for complete detailed code.

Explanation:

See attached file.

Download txt
3 0
3 years ago
CAN SOMEONE PLEASE PLEASE HELP ME OUT !!!!
34kurt

Answer:the answer is A

Explanation: develop a test to see what kind of circuits it takes to power a oven

4 0
3 years ago
In a binary search, _______________________________ . a. It is assumed that all of the elements are integers. b. It is assumed t
madam [21]

Answer:

d. It is assumed that the search pool is ordered.

Explanation:

A binary search/logarithimic search/half interval search/binary chop refers to search algorithm in computer science that sorts data in array in key:value arrangements. In order to locate a value in binary search, the key to the value in a sorted array is located. A binary search is characterized by an ascending, descending order arrangement of the array.

6 0
3 years ago
Can we change our profile name on here and how
TiliK225 [7]
Only by making a new account
4 0
3 years ago
Read 2 more answers
Other questions:
  • When desktop publishing software can interact with another software program, the two are said to
    6·1 answer
  • What is the primary criticism against a national identification system based on biometric data?
    13·1 answer
  • Which button could Pamela press in the Microsoft Word spell checker to make the word “colour” instantly change to “color” whenev
    11·1 answer
  • What tabs found in the Windows Task Manager dialog box
    7·1 answer
  • Create a program that prints out a list of all the divisors of a number stored in a variable. (If you don’t know what a divisor
    11·1 answer
  • A variable that can have values only in the range 0 to 65535 is a :
    5·1 answer
  • Jeremy wishes to create a site map for his website. What tag will surround the URL of his home page?
    9·1 answer
  • Users at UC need to be able to quickly create a Resource record from the Project record's Chatter feed How should the App Builde
    10·1 answer
  • 100 tickets are sold in a raffle with one prize. John has 8 tickets, Jamie has 10 tickets, find the probability that John wins
    11·2 answers
  • Why would a store owner want to calculate a mean
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!