Assignment 2 problems - Assignment#2 Due Date Wednesday...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Assignment #2 Due Date: Wednesday, February 4 at 11:59pm Submit: WebCT Late Policy: -1 point per minute late Instructions: This is an individual assignment. Answers should be your own work. Chapter 2 5 pts 1. In the definition of Big-O, why is the "for N >= n0" needed? 5 pts 2. If f1(N) = 2N and f2(N) = 3N, why are they both O(N)? 5 pts 3. For f1(N) = 2N and f2(N) = 3N, compare the values f1(10) with f1(20) and f2(10) with f2(20). What do you notice in the comparisons? 5 pts 4. Since Big-O notation is a mathematical tool for functions like f(N) or g(N), how is it applicable to algorithm analysis? 5 pts 5. Which grows faster, 2^n or n! ? Why? 10 pts (2 each) 6. Give the Big-O notation for the following expressions: a. 4n^5 + 3n^2 - 2 b. 5^n - n^2 + 19 c. (3/5)*n d. 3n * log(n) + 11 e. [n(n+1)/2 + n] / 2 Questions 7-10 are 7 points each. Use the following declarations for questions 6-9. 7. What is the Big-O running time for this code? Explain your answer. for (int i=0
Image of page 1

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

View Full Document Right Arrow Icon
Sheet1 Page 2 System.out.println(i+1) 8. What is the Big-O running time for this code? Explain your answer.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern