12 10 pts a binary min heap contains the keys 1 2 2

12. (10 pts) A binary min-heap contains the keys 1,2, . . . ,213-1,213. What is thesmallestkey that canbe on aleaf node?13. For each statement below, decide whether it is true or false. In each case attach avery briefexpla-nation of your answer.(a) Iff(n)≤0.001g(n) for alln <1000 thenf(n) isO(g(n), true or false?(b) LetAbe an algorithm that, for eachn >0, takes less than 1000 steps for all inputs of sizenexcept for three of these inputs, on which it takes an average ofnsteps. Then, the worst-caserunning time ofAisO(n), true or false?(c) Suppose we decide to change our JAVA model of computation by counting,in addition, also1 step for each argument of each method call.In this new model, a program has the sameasymptotic complexity than in our JAVA model of computation, true or false?(d) All the Fibonacci numbers are smaller than 1,000,000,000,000,000,000, true or false?14. In this problem you NOT allowed to use any of the theorems about Big-Oh stated in the lectureslides, the textbook, or the lab writeups. Your proof should rely only on the definition of Big-Oh.Prove thatn+1√nisO(√n).15. Consider the algorithmINPUT: array of integersAof lengthnk←n%3ifk= 0thenreturn6

This preview has intentionally blurred sections.
Sign up to view the full version.

3. Divide the array portion betweenloandhiinto three (approximately) equal parts. Callinsertion-sortto order the middle third, then recursively callauxfor the lower third, and finally recursivelycallauxfor the upper third.(a) LetT(n) be the worst-case running time forsorton an array of lengthn. Write a recurrencerelation forT(n).On the right side of the recurrence relation do not include the terms ofthe formc npwherep≥0,except for the term of highest degree.Just give the relation, noexplanations are required.

This preview has intentionally blurred sections.
Sign up to view the full version.

What students are saying

As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran
Temple University Fox School of Business ‘17, Course Hero Intern

I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana
University of Pennsylvania ‘17, Course Hero Intern

The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.