In-class-exercise3-2019-0320.docx - Name Student ID CS206B 2019 SPRING 1 | P a g e Name Student ID CS206B 2019 SPRING 2 | P a g e Name Student ID

# In-class-exercise3-2019-0320.docx - Name Student ID CS206B...

This preview shows page 1 - 5 out of 5 pages.

Name: Student ID: CS206B. 2019 SPRING 1 | P a g e
Name: Student ID: CS206B. 2019 SPRING 2 | P a g e
Name: Student ID: Problem 1. If the running time of an algorithm does not depend on the size of the input n , the algorithm runs in ______(a)_____ time. Using the big-Oh notation, we say the running time of such an algorithm is _____(b)______ . Fill in the blanks. (1 point @ each) Problem 2. Show that (n+1) 5 is O(n 5 ), based on the big-Oh definition. Problem 3. 1) Describe an efficient algorithm for finding the ten largest elements in an array of size n. 2) What is the running time of your algorithm? In your answer use the big-Oh notation, in terms of an array of size n . O(n) Problem 4. Order the following functions by increasing growth rate. (No partial credit) CS206B. 2019 SPRING 3 | P a g e
Name: Student ID: Problem 5. Here is the story about the inventor of the game of chess. He asked only that his king pay him 1 grain of rice for the first square on the board, 2 grains for the second square, 4 grains for the third square.

#### You've reached the end of your free preview.

Want to read all 5 pages?

• Summer '10
• Big O notation, Analysis of algorithms

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

Jill Tulane University ‘16, Course Hero Intern