I've spent a while researching this, and haven't found an answer yet, and I know that a 40+ year old language with all sorts of features probably does this.
I'm looking for a data structure to hold 500 ints only. I need to be able to compare the max int in that with a given int. I also want the structure to remove the earliest inserted, like a queue.
Is there a data structure that supports both? I do not need random access except to run min()
on it.
There are priority queues, which support max
but they don't autohandle the size. I can write my own function to do this but thought I would ask anyways/