/*! 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} Q24E A binary counter of unspecified ... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

A binary counter of unspecified length supports two operations: increment (which increases its value by one) and reset (which sets its value back to zero). Show that, starting from an initially zero counter, any sequence of n increment and reset operations takes time O(n); that is, the amortized time per operation is O(1) .

Short Answer

Expert verified

Binary counter is supports unclear length of two type of operations. On that basses increment and reset (1 & 0) is happen. It’s starts from zero counter and continue in sequence base on n increment & reset operations.

Step by step solution

01

Use of taxation technique

Be using the taxation technique of amortised analysis to establish approximatelybinary increase & resets operations on a binary counter.

This taxation approach applies taxes solely to specific operations, ensuring that the overall cost of those operations does not exceed the tax paid. The tax paid by those operations is the amortised cost.

02

Detail of taxation approach technique.

Description:

Always one bit gets coded as 1 when a counter is incremented.

• When change any bit of something like the binary counters to 1 , set amortised cost to$2.

• Switch it to 1 using $1and preserve some other$1for future reset operations.

• As a result, whenever a bit is set to 1 , a$1credit is provided.

• Assume the counter is reset after

1k =" " p =" "style = "box - sizing : border - box;">/k=" " style = "box - sizing : border - box;" >

• As a result, the reset procedure always has enough money to return the counter to zero.

• As a result, O(n) time will be required for n increment and reset operations.

As a result, the average cost per operation will be O(1) .

03

Final Conclusion.

1 bit is get coded as 1 when computer counting ingormation is increase. And binary counter is 1 when set amortised cost is $2 . So, as a result the reset procedure always has enough money to way back the counter till zero.

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

Consider the following graph.

(a) What is the cost of its minimum spanning tree?

(b) How many minimum spanning trees does it have?

(c) Suppose Kruskal’s algorithm is run on this graph. In what order are the edges added to the MST? For each edge in this sequence, give a cut that justifies its addition.

In this problem, we will develop a new algorithm for finding minimum spanning trees. It is based upon the following property:

Pick any cycle in the graph, and let e be the heaviest edge in that cycle. Then there is a minimum spanning tree that does not contain e.

(a) Prove this property carefully.

(b) Here is the new MST algorithm. The input is some undirected graph G=(V,E) (in adjacency list format) with edge weights {we}.sort the edges according to their weights for each edge e∈E, in decreasing order of we:

if e is part of a cycle of G:

G = G - e (that is, remove e from G )

return G , Prove that this algorithm is correct.

(c) On each iteration, the algorithm must check whether there is a cycle containing a specific edge . Give a linear-time algorithm for this task, and justify its correctness.

(d) What is the overall time taken by this algorithm, in terms of |E|? Explain your answer.

Under a Huffman encoding of symbols with frequenciesf1,f2,.....,fn , what is the longest a codeword could possibly be? Give an example set of frequencies that would produce this case.

The following table gives the frequencies of the letters of the English language (including the blank for separating words) in a particular corpus.

blank

18.3%

r

4.8%

y

1.6%

e

10.2%

d

3.5%

p

1.6%

t

7.7%

l

3.4%

b

1.3%

a

6.8%

c

2.6%

v

0.9%

o

5.9%

u

2.4%

k

0.6%

i

5.8%

m

2.1%

j

0.2%

n

5.5%

w

1.9%

x

0.2%

s

5.1%

f

1.8%

q

0.1%

h

4.9%

g

1.7%

z

0.1%

  1. What is the optimum Huffman encoding of this alphabet?
  2. What is the expected number of bits per letter?
  3. Suppose now that we calculate the entropy of these frequencies

H=∑t=026ptlog1pt

(see the box in page 143). Would you expect it to be larger or smaller than your answer above? Explain.

d. Do you think that this is the limit of how much English text can be compressed? What features of the English language, besides letters and their frequencies, should a better compression scheme take into account?

Show that if an undirected graph with n vertices has k connected components, then it has at least n - k edges.

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.