14. Summer 2009 with Solutions

14. Summer 2009 with Solutions - CS570 Analysis of...

• Notes
• dang026tangwenye11
• 9

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

CS570 Analysis of Algorithms Summer 2009 Exam I Name: _____________________ Student ID: _________________ Maximum Received Problem 1 20 Problem 2 10 Problem 3 10 Problem 4 20 Problem 5 15 Problem 6 10 Problem 7 15 Total 100 This study resource was shared via CourseHero.com

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

2 hr exam Close book and notes 1) 20 pts Mark the following statements as TRUE or FALSE . No need to provide any justification. [ TRUE/FALSE ] T An array with following sequence of terms [20, 15, 18, 7, 9, 5, 12, 3, 6, 2] is a max- heap. [ TRUE/FALSE ] T Complexity of the following shortest path algorithms are the same: - Find shortest path between S and T - Find shortest path between S and all other points in the graph [ TRUE/FALSE ] T In an undirected weighted graph with distinct edge weights, both the lightest and the second lightest edge are in the MST. [ TRUE/FALSE ] F Dijkstra’s algorithm works correctly on graphs with negative-cost edges, as long as there are no negative-cost cycles in the graph. [ TRUE/FALSE ] T Not all recurrence relations can be solved by Master theorem. [ TRUE/FALSE ] F Mergesort does not need any additional memory space other than that held by the array being sorted. [ TRUE/FALSE ] T An algorithm with a complexity of O(n 2 ) could run faster than one with complexity of O(n) for a given problem. [ TRUE/FALSE ] F There are at least 2 distinct solutions to the stable matching problem--one that is preferred by men and one that is preferred by women. [ TRUE/FALSE ] F A divide and conquer algorithm has a minimum complexity of O(n log n) since the height of the recursion tree is always O(log n) . [ TRUE/FALSE ] T Stable matching algorithm presented in class is based on the greedy technique. This study resource was shared via CourseHero.com
2) 10 pts a) Arrange the following in the increasing order of asymptotic growth. Identify any ties. lg n 10 , 3 n , lg n 2n , 3n 2 , lg n lg n , 10 lg n , n lg n , n lg n If lg is log2 (convention), lg n 10 < lg n 2n < lg n 2n = n lg n < 3n 2 < 10 lg n < n lg n < 3 n If lg is log10 (from ISO specification) lg n 10 < lg n 2n < 10 lg n < lg n 2n = n lg n < 3n 2 < n lg n < 3 n b) Analyze the complexity of the following loops: i- x = 0 for i=1 to n x= x + lg n end for O(n) ii- x=0 for i=1 to n for j=1 to lg n x = x * lg n endfor endfor O(nlogn) iii- x = 0 k = “some constant” for i=1 to max (n, k) x= x + lg n end for O(n) iv- x=0 k = “some constant” for i=1 to min(n, k) for j=1 to lg n x = x * lg n endfor endfor O(logn) This study resource was shared via CourseHero.com

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

This is the end of the preview. Sign up to access the rest of the document.
• Fall '11
• Arthur
• Graph Theory, sh, ar stu, Shortest path problem

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