Object-Oriented Programming · Citadel · Hard
Requirements Design a data structure that supports these operations: insert(id, weight) — register an item under id with the specified weight. remove(id) — eliminate an item that is currently stored. sample() -> id — choose and return an item identifier at random, with each item's probability proportional to its current weight. The implementation must keep all three operations efficient while insertions and removals continue to change the collection. A solution intended only…
Checking your access…