{
  "status": "research",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-20",
  "slug": "misra-gries",
  "term": "Misra-Gries summary",
  "aliases": [
    "Misra-Gries algorithm",
    "Frequent algorithm"
  ],
  "definition": "A Misra-Gries summary keeps a bounded set of labelled counters that contains every item exceeding a specified fraction of an insertion-only stream.",
  "note": "With m counters and N unit arrivals, increment a tracked key or allocate a free counter. If all counters are occupied by other keys, decrement each and discard the new arrival, removing zero counters. Every key with frequency strictly greater than N/(m+1) survives; equality is not enough. A surviving counter is a lower bound, not an exact count or a top-m ranking. [misra2018] [mergeable]\n\nLet R be the remaining counter sum. The number of decrement rounds is D = (N-R)/(m+1). For any key, including an untracked key with counter zero, its true count lies between c and c+D. Candidates with c <= R/(m+1) cannot exceed the original strict threshold N/(m+1) and can be removed before an exact recount. [mergeable] [misra2018]\n\nFor the constructed stream A B C A B D A A A B with two counters, the result is A:3, B:1 and D=2. Exact counts are A:5, B:3, C:1, D:1. B can be rejected immediately: its upper bound 3 cannot exceed 10/3. The only remaining candidate is A. [worked]",
  "related": [
    "space-saving",
    "count-min-sketch",
    "cache-admission"
  ],
  "citations": [
    {
      "id": "misra2018",
      "title": "Jayadev Misra. A Proof of a Heavy Hitters Algorithm, 7 February 2018, section 3.",
      "url": "https://www.cs.utexas.edu/~misra/Notes.dir/HeavyHitters.pdf",
      "accessed": "2026-11-20"
    },
    {
      "id": "mergeable",
      "title": "Agarwal, Cormode, Huang, Phillips, Wei and Yi. Mergeable Summaries, section 2, Lemmas 1-2.",
      "url": "https://users.cs.utah.edu/~jeffp/papers/merge-summ.pdf",
      "accessed": "2026-11-20"
    },
    {
      "id": "worked",
      "title": "Hesela. Frequent-item certificates: exact examples, executable model and tests.",
      "url": "https://hesela.dev/research/heavy-hitter-certificates/README.md",
      "accessed": "2026-11-20"
    }
  ],
  "provenance": [
    "The original algorithm is due to Misra and Gries (1982); the linked 2018 author note supplies the residual-candidate proof. Here m counts slots, so the note's k equals m+1.",
    "The example counts unit requests for exact identities, not bytes, latency or physical I/O. It is a deterministic illustration, not an empirical cache study.",
    "The stated guarantees cover cumulative unit insertions. Weighted updates, deletions, sliding windows and counter saturation require their own contracts."
  ]
}
