Say I have a simulation that needs to pick between many discrete events with given weights, with the weights themselves following a known distribution.
I need some structure that supports updates, and efficiently picks random events.
It is trivial to get O(log(n))
insertion, deletion, and random-choice operations, with a binary search tree. It should be possible to improve the random-choice operation, with interpolation search for example.
What are some theoretical results stronger than this, or known good implementations?
EDIT: I consider Niklas's reply to this comment about the O(log* n)
algorithm (ftp.cs.brown.edu/pub/techreports/92/cs92-36.pdf)to be exactly what I was looking for.