/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} 21E A vertex cover of a graph G=(V,E... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

A vertex cover of a graph G=(V,E)is a subset of vertices S⊆Vthat includes at least one endpoint of every edge in E. Give a linear-time algorithm for the following task.

Input: An undirected tree T=(V,E).

Output: The size of the smallest vertex cover of T. For instance, in the following tree, possible vertex covers include{A,B,C,D,E,F,G}and{A,C,D,F}but not{C,E,F}.The smallest vertex cover has size 3: {B,E,G}.

Short Answer

Expert verified

The recursion will run in linear time that is On.

Step by step solution

01

Defining Recurrence relation

We have given a graphG=V,E where we have to find the smallest vertex cover. Vertex cover is a set of vertices that includes at least one endpoint of every edge of the graph. In order to find the size of smallest vertex cover of the given graph, we will use dynamic programming approach where we will find out all possible vertex cover of all subproblems and then select that vertex cover which is smallest.

vi=min∑j:j∈Childi1+∑k:k∈Childjvk,1+∑j:j∈Childivj

02

Solution.

Let us suppose that for each node ‘(u)’ in the graph, we considerVuas the size of minimum vertex cover for a subtree which is rooted at node ‘u’.

Fig: A undirected graph.

Vertex cover is a set of vertices that includes at least one endpoint of every edge of the graph. In order to find the size of smallest vertex cover of the given graph, we will use dynamic programming approach where we will find out all possible vertex cover of all subproblems and then select that vertex cover which is smallest.

Our base condition will be when our node ‘u’ is leaf node. In this case, Vu=0. This is because we cannot obtain subtree from leaf node.

For any internal node of a subtree, we have:

vi=min∑j:j∈Childi1+∑k:k∈Childjvk,1+∑j:j∈Childivj

On solving the above recursive equation, we will get output as Vr, where r is the root of the tree. Thus,Vris the size of the minimum vertex cover. The algorithm according to the above stated recursion relation, solve all the subproblem in order of decreasing depth of the tree.

This recursion will run in linear time that is On.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91Ó°ÊÓ!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Alice wants to throw a party and is deciding whom to call. She has n people to choose from, and she has made up a list of which pairs of these people know each other. She wants to pick as many people as possible, subject to two constraints: at the party, each person should have at least five other people whom they know and five other people whom they don’t know. Give an efficient algorithm that takes as input the list of n people and the list of pairs who know each other and outputs the best choice of party invitees. Give the running time in terms of n

Show that any array of integers x[1…n] can be sorted in O (n + M) time, where

role="math" localid="1659938331794" M=maxxi-minxiii

For small M, this is linear time: why doesn’t the Ω(nlogn) lower bound apply in this case?

The Fibonacci numbers F0,F1,F2,... are defined by the rule

F0=0,F1=1,Fn=Fn−1+Fn−2.

In this problem we will confirm that this sequence grows exponentially fast and obtain some bounds on its growth.

(a) Use induction to prove that Fn≥20.5nfor n≥6.

(b) Find a constant c<1such thatFn≥2cn for all n≥0. Show that your answer is correct.

(c) What is the largestc you can find for which Fn=Ω(2cn)?

Question: 0.1. In each of the following situations, indicate whether ´Ú=°¿(²µ),´Ç°ù´Ú=Ω(²µ),or both (in which case f=⊙(g))

Show that, if c is a positive real number, then g(n) = 1 + c + c2 + · · · + cn is:

(a) Θ(1) if c < 1.

(b) Θ(n) if c = 1.

(c) Θ(cn) if c > 1.

The moral: in big-Θ terms, the sum of a geometric series is simply the first term if the series is strictly decreasing, the last term if the series is strictly increasing, or the number of terms if the series is unchanging.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.