{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs320-2010-t1-midterm1-solution

cs320-2010-t1-midterm1-solution - CPSC 320 Midterm 1 Monday...

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

View Full Document Right Arrow Icon
CPSC 320 Midterm 1 Monday, October 18th, 2010 [13] 1. Short answers [4] a. We frequently prove an O ( n 2 ) bound on the worst-case running time T ( n ) of an algorithm, without proving any Ω bound on T ( n ) . However, we would never prove an Ω( n 2 ) bound on T ( n ) without also proving a O bound on T ( n ) . Why not? Solution : Proving an Ω( n 2 ) bound on T ( n ) simply means that the algorithm runs slowly. There is no point in giving an algorithm without providing an upper-bound on its running time (since then the algorithm might be arbitrarily bad). [4] b. Why is Dijkstra’s algorithm greedy? Solution : Because at each iteration of the for loop, it adds to the tree the vertex with the smallest cost at that point, without considering what that might mean for future iterations. [5] c. Mr. Isulo, a famous alien computer scientist, has designed a greedy algorithm to solve the Clique problem (you don’t need to know what it is) on a type of graphs called circular arc graphs (you don’t need to know what they are either). His algorithm starts by choosing the vertex with the most neighbours. Mr. Isulo wants to prove the following lemma: “Every circular arc graph has a max- imum clique that contains the vertex with the most neighbours”, but he eventually finds a counter-example to his conjecture. What does this imply for Mr. Isulo’s algo- rithm, and why? Solution : All of the solutions constructed by Mr. Isulo’s algorithm will contain the vertex with the most neighbours, since a greedy algorithm never removes the vertices it has chosen. Because the lemma is false, his algorithm will not return the correct
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
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