Reputation: 4281
Since it's a 'queue', shouldn't the method be called front()
rather than top()
? Is there some reason behind this?
Upvotes: 1
Views: 122
Reputation: 19761
It's because (in my estimation - as I didn't name it..) they're commonly implemented with heaps which conceptually have a top - as in stuff rises to the top of the heap to be taken off next.
https://en.wikipedia.org/wiki/Priority_queue
Upvotes: 2