Give an algorithm that takes an n-node path g with weights

Assignment Help Data Structure & Algorithms
Reference no: EM13164825

Let G = (V,E) be an undirected graph with nnodes. Recall that a subset of the nodes is called an independentset if no 2 of them are joined by an edge. Finding largeindependent sets is difficult in general; but here we'll seethat it can be done efficiently if the graph is"simple" enough.

              Call a graph G=(V,E) a path if its nodes can be written as v1, v2,..., vn, with an edge between vi and vjif and only if the numbers i and j differ by exactly 1. With eachnode vi, we associate a positive integer weightwi.

               Consider for example the five-node path drawn below. The weightsare the numbers drawn inside the nodes, and the total weight is14.

 

30_Independent Set On A Path.jpg

 

 The goal in this question is to solve the following problem: Findan independent set in a path G whose total weight is as large aspossible.

For the exercises(a) and (b), give your counterexample. For the exercise (c), showthe optimal structure (with an explanation), give the bottom-updynamic programming algorithm, and show the running-timeanalysis.

a) Give an example to show that the followingalgorithm does not always find an independent set of maximum totalweight.

               The "heaviest-first" greedy algorithm

           Start with S equal to the empty set

           While some node remains in G

                 Pick a node vi of maximum weight

                 Add vi to S

                 Delete vi and its neighbors from G

           Endwhile

           Return S

b) Give an example to show that the following algorithm alsodoes not always find an independent set of maximum totalweight.

               Let S1 be the set of all vi where i is an odd number

      Let S2 be the set of allvi where i is an even number

      (Note that S1 and S2 are bothindependent sets)

Determine which of S1 or S2 hasgreater total weight, and return this one

c) Give an algorithm that takes an n-node path G with weightsand returns an independent set of maximum total weight. The runningtime should be polynomial in n, independent of the values of theweights

Reference no: EM13164825

Questions Cloud

What was the wavelength of the second photon emitted : What was the wavelength of the second photon emitted?
How many moles of oxygen gas was evolved : KCL,KCLO3, and MnO2 having a total wight of 23.584 was jeated tp decompose the KCLO3. After heating, the mass was found to be 22.347g. how many moles of oxygen gas was evolved.
A mobile app has to dynamically select an encryption : A mobile app has to dynamically select an encryption algorithm based on security requirements and computing time constraints.
How much solid sodium sulfate should you add : You need to make an aqueous solution of 0.180 M sodium sulfate for an experiment in lab, using a 250 mL volumetric flask. How much solid sodium sulfate should you add ?
Give an algorithm that takes an n-node path g with weights : Give an algorithm that takes an n-node path G with weightsand returns an independent set of maximum total weight. The runningtime should be polynomial in n, independent of the values of theweights
Find the heat of solution for lithium iodide : Lithium iodide has a lattice energy of -7.3 times 10^2kJmol and a heat of hydration of -793kj/mol. Find the heat of solution for lithium iodide.
Write a program in which the user is prompted : Write a program in which the user is prompted for the number of values that they will be entering. The user then enters that number of integers into an array
Write a balanced chemical equation for the decomposition : Write a balanced chemical equation for the decomposition of limestone, CaCO3, to quicklime, CaO, and carbon dioxide.
What is the new water level after of silver metal : A graduated cylinder contains 31.0 of water. What is the new water level after 38.0 of silver metal is submerged in the water?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Question about key encryption

Assume Alice wishes to send an e-mail to Bob. Bob has a public private key pair, Alice has Bob's certificate. But Alice does not have a public, private key pair.

  Creating uml collaboration diagrams

Create UML collaboration diagrams using Microsoft Visio or another making tool capable of creating properly formatted UML collaboration diagrams.

  Write computer program to implement this algorithm

Write computer program to implement this algorithm and demonstrate the results and what is the machine run time in second for sorting array A?

  Design algorithm to find the average miles per gallon

Design an algorithm to find the average miles per gallon. Sample data: 68723, 71289, 15.75, 16.30, 10.95, 20.65, 30.00.

  Write a xml schema for the validation of the document notes.

write a XML schema for the validation of the document notes.xml. Write the schema according to the following three approaches;1.- Based on the document structure2.- Structured (bottom-up design)3.- Type-based (top-down design)

  Different network connections

Use your laptop at public store to check your email and discuss all the different network connections involved in this operation.

  An algorithm that will sort a with a worst-case runtime

Let A be an array with n elements such that the first n -sqrt( n) elements are already sorted (though we know nothing about the remaining elements). Give an algorithm that will sort A with a worst-case runtime substantially better than O(n logn).

  Write schedule produced by earliest deadline first algorithm

Given below are two sets of real-time, periodic tasks. For (a), will the schedule produced by Earliest Deadline First algorithm meet all the deadlines?

  Algorithm to produce schedule for least completion time

What is the best order for sending people out, if one wants whole competition to be over as early as possible? More precisely, provide efficient algorithm which produces schedule whose completion time is as small as possible.

  How many leaf nodes can a decision tree have

At most how many leaf nodes can a decision tree have if it is consistent with a training set containing 100 examples?

  Question about trigger

What are triggers used for, and why are they important in database systems? Give an example of a situation where a trigger would be appropriate.

  C++ program to evaluate expressions combining set union

Create a C++ program to evaluate expressions combining set union, set intersection and parentheses

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd