Lab4-AlgAnalysis

# Lab4-AlgAnalysis - Computer Science I Summer 2011...

This preview shows pages 1–2. Sign up to view the full content.

Computer Science I – Summer 2011 Recitation #4: Algorithm Analysis Spend no more than THREE minutes each on the next four questions (12 min total). Directions: For questions 1 – 4, utilize the technique shown in class of setting up an equation with a constant, solve for that constant, and then answer the given question. 1) For an O(n 3 ) algorithm, one data set with n = 3 takes 54 seconds. How long will it take for a data set with n = 5? 2) For an O(2 n ) algorithm, a friend tells you that it took 17 seconds to run on her data set on a O(2 n ) algorithm. You run the same program, on the same machine, and your data set with n = 7 takes 68 seconds. What size was her data set? 3) For an O(N k ) algorithm, where k is a positive integer, an instance of size M takes 32 seconds to run. Suppose you run an instance of size 2M and find that it takes 512 seconds to run. What is the value of k? 4) Assume that an O(log 2 N ) algorithm runs for 10 milliseconds when the input size ( N ) is 32. What is input size makes the algorithm run for 14 milliseconds?

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

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