in reply to Data Structure needed for Event Queue

You could always just shove it into a database with an index. {grin}

I'm not a CS expert, but I think a B-tree might be the right structure (see http://perl.plover.com/BTree/). Pure Perl B-Tree managers are available, such as Tree and Btrees. I think even a Berkeley DB can be stored "in core" with the BerkeleyDB module, and there's a B-Tree version of that.

-- Randal L. Schwartz, Perl hacker


update: yes, with DB_File, you can set up an in-memory DB (use undef for the filename), and with the right comparison callback, you get basic operations like
## add a new $nextevent at $time: push @{$db{$time}}, $nextevent; ## get the lowest event list keys %db; # reset pointer my ($time, $events) = each %db; # lowest events