I'm currently looking for a data structure with all O(1) operations
- insert(K, V): Insert a value at the end of the queue.
- remove_key(K): Remove the value from the queue corresponding to the provided key.
- remove_head(): Remove the value from the front of the queue (the oldest one).
The only reasonably easy to implement thing I can think of is using a doubly linked list as the primary data structure, and keeping pointers to the list nodes in a hash table, which would get the desired asymptotic behavior, however this might not be the most efficient option in actual runtime.
I found "addressable priority queues" in the literature, but they are rather complicated (and maybe even more expensive) data structures, so I was wondering if someone has a better suggestion. It seems no one implemented something like this for Rust so far, which is why I'm hoping it doesn't get too complicated.