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

Short Answer

Expert verified

Each vertex with each member inside the vertex set, such asuandv , indicates that the person v knows the person u . So, find the subset v where another vertex has a value greater than 5 , then repeat the process with both the modified degrees for every node until a network is formed in which neither vertex may be destroyed after the procedure is finished. As a result, the running time's total complexity has increased.

Step by step solution

01

Individual String ‘Fi’

Assuming that each individual attends the party with at least 5 different other things they trust and five others they don't. Throughout a few places in the question, every string 'fi' has been substituted with '?'. If you have any doubts about my answer, please leave a remark.

02

Vertex for Each Set

Assume the graph GV,E, which has a vertex for each person in the vertex set. If an edge e connects the vertices uandv, , it means that the person v is acquainted with the person u . So, in the induced network [where V ' is the new set of vertices], we may restrict the task to identifying a subset V of V whereby each vertex has a value more than 5 and less than|V'|-5 .

The continuous strategy can be used, in which all nodes are examined at first, and any node with a degree more than role="math" localid="1658920458569" |V'|-5orlessthan5 is eliminated. This graph is changed to be the induced graph, with the remaining vertices being assigned to the vertex set. This technique is repeated with the updated degrees for each node until a graph is formed in which no vertex may be deleted once the operation is completed. G' is the symbol for this graph. There are n iterations in the algorithm, and each iteration takes On time. As a result, the overall complexity of the running time is role="math" localid="1658920588246" O(n2).

03

Conclusion  

A vertex for each person in the vertex set like u and v means the person v is acquainted with the person u. So, identifying of sub set v where each vertex has value more than 5. same way this technique is repeated with the updated degrees for each node until a graph is form in which no vertex may deleted once the operation is complete. As a result overall complexity of the running time.

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 Vaia!

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

The kSPANNING TREE problem is the following.Input: An undirected graph G=(V,E) Output: A spanning tree of G in which each node has degree k, if such a tree exists.Show that for any k2:

  1. k SPANNING TREE is a search problem.
  2. k SPANNING TREE is NP-complete. (Hint: Start with k=2 and consider the relation between this problem and RUDRATA PATH.)

Question: An Eulerian tourin an undirected graph is a cycle that is allowed to pass through each vertex multiple times, but must use each edge exactly once.

This simple concept was used by Euler in to solve the famous Konigsberg bridge problem, which launched the field of graph theory. The city of Konigsberg (now called Kaliningrad, in western Russia) is the meeting point of two rivers with a small island in the middle. There are seven bridges across the rivers, and a popular recreational question of the time was to determine whether it is possible to perform a tour in which each bridge is crossed exactly once. Euler formulated the relevant information as a graph with four nodes (denoting land masses) and seven edges (denoting bridges), as shown here.

Notice an unusual feature of this problem: multiple edges between certain pairs of nodes.

(a) Show that an undirected graph has an Eulerian tour if and only if all its vertices have even degree. Conclude that there is no Eulerian tour of the Konigsberg bridges.

(b) An Eulerian pathis a path which uses each edge exactly once. Can you give a similar if-and-only-if characterization of which undirected graphs have Eulerian paths?

(c) Can you give an analog of part (a) for directedgraphs?

Consider the following game. A “dealer” produces a sequence s1···sn of “cards,” face up, where each card si has a value vi. Then two players take turns picking a card from the sequence, but can only pick the first or the last card of the (remaining) sequence. The goal is to collect cards of largest total value. (For example, you can think of the cards as bills of different denominations.) Assume n is even. (a) Show a sequence of cards such that it is not optimal for the first player to start by picking up the available card of larger value. That is, the natural greedy strategy is suboptimal. (b) Give an O(n2) algorithm to compute an optimal strategy for the first player. Given the initial sequence, your algorithm should precompute in O(n2) time some information, and then the first player should be able to make each move optimally in O(1) time by looking up the precomputed information.

A vertex cover of a graph G=(V,E)is a subset of vertices SVthat 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}.

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.

Sign-up for free