CPSC
Exercises 07 - CPSC 413 F18.pdf

# 3 trees let t v e be a tree on n vertices we say that

• 3

This preview shows page 3. Sign up to view the full content.

3. [Trees] Let T = ( V, E ) be a tree on n vertices. We say that a vertex v V is a split vertex if each of the subtrees in the forest T \ { v } has size at most n 2 . That is, if removing v from T results in a set of trees each of which has size at most half the original size. Give an example of a tree that has two split vertices. Show that every tree T has at least one and at most two split vertices. 4. Fix a tree T = ( V, E ) where every vertex is of degree at most 4, i.e., no vertex has more than 4 neighbors. Consider that each vertex v V is labelled with an integer a v . We say v is a local minimum if a v a u for all v ’s neighbors u in T . Give an algorithm that runs in time O (log n ) and that outputs a local minimum in T . Here n = | V | . ( Hint: Use split vertices of T . Assume that we have pre-computed split vertices prior to be given the inputs a v .) 10. (Greedy) Minimum Spanning Trees We are given an undirected graph G = ( V, E ) and positive weights c : E → < > 0 . Consider the following recursive algorithm for computing a minimum spanning tree. Rec-MST ( G, c ) (i) If | V | = 1, return . (ii) Let v V be an arbitrary vertex in V . Let E v be the set of edges incident to v . Let G 0 G - { v } be the graph obtained by removing v and all its incident edges. (iii) Recursively, compute T 0 Rec-MST ( G 0 , c ). (iv) Let e E v be an edge of the least cost among all edges in E v . (v) Return T ∪ { e } . This algorithm builds a spanning tree for G by first recursively building a spanning tree for G - { v } and then adding an edge that touches v of the least cost. This algorithm correctly builds a spanning tree, and it runs it time polynomial in n = | V | . It fails, however, in always computing a minimum spanning tree. 1. Show that this algorithm may fail in computing a minimum spanning tree. That is, find a counter-example. ( Hint: There are small counter-examples.)
This is the end of the preview. Sign up to access the rest of the document.
• Fall '13
• GeoffCruttwell
• Recursion, Recurrence relation, ev

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