subject

Suppose that you want to sort an array into ascending order using insertion sort. the array contains the integers 0 through n in some order, where n is even and n > 2. (that means it contains n+1 integers! ) during the quiz, you will be asked how many comparisons are performed in various situations. this refers to comparisons of the array elements being sorted. in each case, express your answer as a polynomial in simplest terms

a)

suppose the array begins with 0, followed by the remaining even numbers in ascending order, followed by the odd numbers in descending order. (for n = 8, the array would be [0,2,4,6,8,7,5,3,1].)

how many comparisons will insertion sort perform when it is executing the pass that moves the element at index 1 into position? (do not assume n = 8.)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
Dr. wisteria is a prominent chiropractor in the chicago area. she wants to provide a forum for her patients to discuss their health concerns and to seek and offer advice to other patients. which telecommunications tool is most appropriate for dr. wisteria's needs?
Answers: 3
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 22.06.2019 20:30
In this lab, you complete a prewritten c program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. bonuses are calculated based on an employee’s productivity score as shown below. a productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked.
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
How can a user delete a drawing object
Answers: 1
You know the right answer?
Suppose that you want to sort an array into ascending order using insertion sort. the array contains...
Questions
question
Mathematics, 06.06.2021 07:30
question
Mathematics, 06.06.2021 07:30
question
Mathematics, 06.06.2021 07:30
question
Mathematics, 06.06.2021 07:30
Questions on the website: 13722363