Run some test inputs on both algorithms and compare

  • No School
  • AA 1
  • 5

This preview shows page 2 - 4 out of 5 pages.

Implement Sequential Search and Binary Search in your favorite programming language. Run some test inputs on both algorithms and compare the running times. NOT SHOWN 9. Implement Selection Sort, Insertion Sort, Bubble Sort and Merge Sort in your favorite programming language. Compare running time on an in order array and a reversed array. What does this show about the best and worst case inputs for these algorithms? NOT SHOWN 10. Please solve exercises 1.4.2 #1 and 1.4.2 #2 in the textbook. (a) The following functions are ordered from fastest growing to slowest growing: n!, 2^n, 2^(n-1), (3/2)^n, n- n^2+5n^3, n^3+ log n, n^3, n^2, n log n, n, sqrt(n), (log n)^2, log n, log log n, 6 (b) Please show which function is faster growing between the following two functions: a.(n^2-n)/2 and 6n (n^2-n)/2 b. n+2sqrt(n) and n^2 n^2 c. n+nlog(n) and n*sqrt(n) n*sqrt(n)
Image of page 2

Subscribe to view the full document.

d. n^2 + 3n + 4 and n^3 n^3 e. n log(n) and n*sqrt(n)/2 n*sqrt(n)/2 f. n + log(n) and sqrt(n) n + log(n) g. 2log(n)^2 and log n +1 2log(n)^2 h. 4nlog(n) + n and (n^2-n)/2 (n^2-n)/2 11. Order the following function from slowest growing to fastest growing: n^3, lg n, 2^n, n, n^2, n lg n lg n, n, n lg n, n^2, n^3, 2^n 12. Use the product rule for derivates [(fg)' = f'g + fg'] to prove by mathematical induction that for every integer n >= 1, the derivative of is .
Image of page 3
Image of page 4

{[ 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