Misra-Gries Counters identify candidate frequent items while storing only a limited number of item identities. The small counters are not exact totals for every item in the stream. When the table fills and an untracked item arrives, a cancellation step removes some evidence from several different identities at once.
The Illinois CS574 notes, Chapter 11 give a unit-update version with at most k stored identities. An item already present increments its counter. A new identity enters with counter one if there is space. If the table is full, the algorithm decreases all existing counters by one and removes entries whose counters reach zero.
In that last branch, the new untracked item is not immediately inserted after the decreases. Its occurrence participates in the cancellation. Adding it anyway would define a different update rule and invalidate a trace based on the stated algorithm.
Take capacity two and the hypothetical seven-item stream A, B, C, A, A, B, A. After the first two observations the table holds A with one and B with one. When C arrives, the table is full, so both counters decrease to zero and are removed. C is discarded by this cancellation branch.

The fourth observation A creates a new counter one. The next A increases it to two. B then enters the available slot with one, and the final A raises its counter to three. The output is therefore A with three and B with one.
The actual full-stream counts are A with four, B with two and C with one. Every stored counter underestimates its corresponding full count, and an absent identity is interpreted as estimate zero. The table has not confused C with another item's hash bucket: it explicitly discarded a cancellation group involving three different identities.
That identity-based mechanism differs from estimating an arbitrary queried item's count from several hashed counter arrays. Here the output contains concrete candidate labels. An identity absent from the table does not come with a saved original record that can later be recovered.
At capacity two, each full-table cancellation can be pictured as removing one occurrence of each of three distinct items: the two tracked identities and the newly arriving identity. No one identity loses more than one occurrence per cancellation group.
Let D count those cancellation steps. A retained counter is no greater than the true count, and any identity's undercount is at most D. Since each cancellation accounts for three distinct occurrences, D is at most the stream length divided by three. For the example, D is one and every count error is one.

There is also a simple accounting check for this unit-decrement trace. The final stored counters sum to four, and the one cancellation group accounts for three discarded occurrences. Four plus three equals the seven arrivals. This identity checks the complete stream length without claiming that the residual four occurrences were the only observations ever made. If an implementation additionally tracks the number of cancellation steps, that value must count the actual full-table branch executions, rather than the number of table entries that happen to disappear.
More generally, k counters cancel groups of k plus one different identities in this version. Any item occurring more than n divided by k plus one times cannot have all its occurrences canceled and must survive. The threshold concerns the true count; it does not say every survivor exceeds that threshold.
In the seven-item example, A occurs four times and survives, as expected. B also survives even though its true count two is below seven thirds. The surviving table therefore should not be presented as a proven exact list of the most frequent items with their exact totals.
If the original stream is available for a second pass, the surviving candidate identities can be counted exactly and tested against a chosen threshold. Without that pass or another source of exact totals, retain the bound and candidate interpretation rather than silently replacing the residual counts with full frequencies.
The Stanford CS246 matrix-sketching lecture introduces the same frequent-item problem but presents a counter variant that decreases by a median counter amount when full. Its capacity notation and stated error bound differ from the unit-decrement algorithm traced here. A citation to the family does not make those update schedules interchangeable.
The current example is append-only, has unit-weight arrivals and never processes deletions. Other weighted or merging designs require their own defined operations and guarantees. The letters represent invented observations rather than actual robot events. Related data-method articles appear in the reference collection and the technical article directory.