/*! 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} Q33E Show that for any integer  n th... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

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 K≥2.

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

Suppose you implement the disjoint-sets data structure usingunion-by-rank but not path compression. Give a sequence ofm union and find operations onnelements that take Ω(mlogn)time.

Question: Suppose the symbols a,b,c,d,e occur with frequencies 12,14,18,116,116,respectively.

(a) What is the Huffman encoding of the alphabet?

(b) If this encoding is applied to a file consisting of1,000,1000 characters with the given frequencies, what is the length of the encoded file in bits?

A prefix-free encoding of a finite alphabet Γ assigns each symbol in Γ a binary codeword, such that no codeword is a prefix of another codeword. A prefix-free encoding is minimal if it is not possible to arrive at another prefix-free encoding (of the same symbols) by contracting some of the keywords. For instance, the encoding {0,101} is not minimal since the codeword 101 can be contracted to 1 while still maintaining the prefix-free property.

Show that a minimal prefix-free encoding can be represented by a full binary tree in which each leaf corresponds to a unique element of Γ, whose codeword is generated by the path from the root to that leaf (interpreting a left branch as 0 and a right branch as 1 ).

Suppose we want to find the minimum spanning tree of the following graph.

(a) Run Prim’s algorithm; whenever there is a choice of nodes, always use alphabetic ordering (e.g., start from node A). Draw a table showing the intermediate values of the cost array.

(b) Run Kruskal’s algorithm on the same graph. Show how the disjoint-sets data structure looks at every intermediate stage (including the structure of the directed trees), assuming path compression is used.

Entropy: Consider a distribution overnpossible outcomes, with probabilities p1,p2,K,pn.

a. Just for this part of the problem, assume that each piis a power of 2 (that is, of the form 1/2k). Suppose a long sequence of msamples is drawn from the distribution and that for all 1≤i≤n, the ithoutcome occurs exactly times in the sequence. Show that if Huffman encoding is applied to this sequence, the resulting encoding will have length

∑i-1nmpilog1pi

b. Now consider arbitrary distributions-that is, the probabilities pi are noy restricted to powers of 2. The most commonly used measure of the amount of randomness in the distribution is the entropy.

∑i-1nmpilog1pi

For what distribution (over outcomes) is the entropy the largest possible? The smallest possible?

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.