Import the AVL tree library at https://github.com/w8r/avl for use in MFU and LFU queues. As frequency queues require sorting of the queue by both frequency and queue joining time, keeping the queue sorted on all operations will be easier than sorting on every pull from the queue.
AVL trees have O(log_2(n)) performance in search, addition, and removal operations at the expense of memory usage.
Import the AVL tree library at https://github.com/w8r/avl for use in MFU and LFU queues. As frequency queues require sorting of the queue by both frequency and queue joining time, keeping the queue sorted on all operations will be easier than sorting on every pull from the queue.
AVL trees have O(log_2(n)) performance in search, addition, and removal operations at the expense of memory usage.