Computers and Technology

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.)

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, lindseyreneesmith7
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
image
Computers and Technology, 22.06.2019 19:20, SundaeSunday
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_balance should be removed since header files should not contain constants. c)the definition of cashregister should be removed since header files should not contain class definitions. d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
image
Computers and Technology, 22.06.2019 22:00, suewignall
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
image
Computers and Technology, 23.06.2019 11:30, talyku7131
Me dangers of social media and the internetexplain what each means: 1) social media and phones have become an addiction.2) outside people have access to you all the time.3) cyberstalking4) cyberbullying5) catphishing6) viruses7) identity theft8) credit card fraud9) hacking10) money schemes
Answers: 1
Do you know the correct answer?
Suppose that you want to sort an array into ascending order using insertion sort. the array contains...

Questions in other subjects: