DEV Community

Discussion on: Finding Max in a Stack

Collapse
 
__orderandchaos profile image
Order & Chaos Creative

Good solution, it saves having to look up the max after each push/pop.

This reminded me of Priority Queues: algs4.cs.princeton.edu/24pq/

Not sure if it fits the criteria of your interview question, but you might find it interesting anyway.

"Priority queues are characterized by the remove the maximum and insert operations"

Collapse
 
racheladaw profile image
Rachel Williams

Thank you for reading!

Priority Queues sound very interesting. I'm definitely going to look those up. Thank you for the input!