# Question: Suppose we wish not only to increment a counter but

Suppose we wish not only to increment a counter but also to reset it to zero (i.e., make all bits in it 0). Show how to implement a counter as an array of bits so that any sequence of n INCREMENT and RESET operations takes time O(n) on an initially zero counter.

**View Solution:**## Answer to relevant Questions

Consider an ordinary binary min-heap data structure with n elements that supports the instructions INSERT and EXTRACT-MIN in O (lg n) worst-case time. Give a potential function Φ such that the amortized cost of INSERT ...Suppose that all edge weights in a graph are integers in the range from 1 to |V|. How fast can you make Prim’ s algorithm run? What if the edge weights are integers in the range from 1 to W for some constant W?Why are pseudo variable logically unnecessary?It is sometime suggested that types are really variables too, like relvar, for example, legal employee number might grow from three digits to four as a business expands, so we might need to update “the set of all possible ...Give Tutorial d formulations for the following updates to the suppliers-parts-projects data-base;(a) Insert a new shipment with supplier number S1, part number P1, project number J2, quantity 500.(b) Insert a new supplier ...Post your question