Course Solutions Uncategorized (Solved) : 5 Following Write Contrapositive Converse Also Input Sorted Insertion Sort Makes N 1 Compa Q32317418 . . . .

(Solved) : 5 Following Write Contrapositive Converse Also Input Sorted Insertion Sort Makes N 1 Compa Q32317418 . . . .

 

5. For each of the following, write the contrapositive and converse. Also, If the input is sorted, Insertion Sort makes at most (n-1) compar- » There is some positive constant c such that: if there are only k ele- write the negations of all the statements you construct isons. ments out of order (in an input of length n), Insertion Sort makes at most cnk comparisons. » Insertion Sort always makes fewer comparisons than Selection Sort 6. For all the statements above, think about whether they are true or false. 7. Give a formal proof (probably using induction) that binary search works on sorted arrays. Where does the proof fail if the array is not sorted? 8. Is the invariant for Selection Sort true for Insertion Sort? And vice versa? 9. Give a formal proof of the correctness of the Merge operation on two sorted arrays.

5.

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post