Show that for any integer n that is a power of 2 , there is an instance of the set cover problem (Section 5.4) with the following properties:

  1. There are n elements in the base set.
  2. The optimal cover uses just two sets.
  3. The greedy algorithm picks at least log n sets.

Thus the approximation ratio we derived in the chapter is tight.

Short Answer

Expert verified

Any integer which count with 2 or count with power of 2 it gives elements in base set and optimal cover using two set in greedy algorithm.

Step by step solution

01

Elements of Even /Odd Numbers

Represent a set with n items that would be a positive integer of 2 . Permit the collection to be. (1,2,...,2k) for some K2.

So ideal number of matches would be two. • One has even numbers, while the other has odd numbers. As a result, the two sets will be localid="1658922602021" X=1,3,...,2k-3,2k-1 andY=2,4,...,2k-2,2k.Y=2,4,...,2k-2,2k..

02

Algorithm of number of 2 ’s in odd / even calculation

Now, Take, for example, a greedy algorithm.

Take into account everything. i ,

Let Di=2(k-1),2(k-i)+1,...,2k-i+1.

Clearly,

A=i=1kD1

Asn=2k

Thus,logn=k

Its foundation setting is the combination of sets handled by greedy.

• Although X and Y do not cover and over half of both the elements, they provide the best solution.

D1, on the other hand, actually covers one additional vertex than X or Y .

As a result, there is a close approximated ratio among both greedy and optimum solutions.

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

Ternary Huffman. Trimedia Disks Inc. has developed “ternary” hard disks. Each cell on a disk can now store values 0,1, or 2(instead of just 0 or 1). To take advantage of this new technology, provide a modified Huffman algorithm for compressing sequences of characters from an alphabet of size n, where the characters occur with known frequencies f1, f2,...., fn. Your algorithm should encode each character with a variable-length codeword over the values 0,1,2, such that no codeword is a prefix of another codeword and so as to obtain the maximum possible compression. Prove that your algorithm is correct

We use Huffman's algorithm to obtain an encoding of alphabet {a,b,c}with frequencies fa,fb,fc. In each of the following cases, either give an example of frequencies (fa,fb,fc)that would yield the specified code, or explain why the code cannot possibly be obtained (no matter what the frequencies are).

(a) Code:{0,10,11}

(b) Code:{0,1,00}

(c) Code:{10,01,00}

Let G=(V,E) be an undirected graph. Prove that if all its edge weights are distinct, then it has a unique minimum spanning tree

Prove the following two properties of the Huffman encoding scheme.

(a) If some character occurs with frequency more than 25, then there is guaranteed to be a codeword of length 1 .

(b) If all characters occur with frequency less than13 , then there is guaranteed to be no codeword of length 1 .

Sometimes we want light spanning trees with certain special properties. Here’s an example.

Input: Undirected graph G=(V,E) ; edge weights we; subset of vertices UV

Output: The lightest spanning tree in which the nodes of U are leaves (there might be other leaves in this tree as well).

(The answer isn’t necessarily a minimum spanning tree.)

Give an algorithm for this problem which runs in O(ElogV) time. (Hint: When you remove nodes Ufrom the optimal solution, what is left?)

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