kanwei / algorithms

Ruby algorithms and data structures. C extensions
http://kanwei.github.io/algorithms/
MIT License
2.67k stars 352 forks source link

Add a priority queue / heap with max size #8

Open dblock opened 13 years ago

dblock commented 13 years ago

It's a pretty common problem (and we have this problem :)) where you want a priority queue that "loses" items of lesser priority (has a max size). What do you think of extending heap?

dblock commented 13 years ago

It's as simple as ad/delete(pop), but not very efficient.