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, 21.06.2019 16:50
3.2.5 suppose that we have an estimate ahead of time of how often search keys are to be accessed in a bst, and the freedom to insert items in any order that we desire. should the keys be inserted into the tree in increasing order, decreasing order of likely frequency of access, or some other order? explain your answer.
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 23.06.2019 00:00
What engine component is shown in the above figure?
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
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, 03.05.2020 13:55
question
English, 03.05.2020 13:55
question
History, 03.05.2020 13:55
question
History, 03.05.2020 13:55
question
Mathematics, 03.05.2020 13:55
question
Spanish, 03.05.2020 13:55