Queues | Sololearn: Learn to code for FREE!



How can I get the max element of a queue and how can I print it? Shoul I include it in pop function or I have to make another function for it?

3/24/2018 3:55:51 PM

Winter Soldier

2 Answers

New Answer


If you are able, you could keep information about your queue as you fill it. I would personally use a class for this. You could also find it the way you mentioned it - with pop(), but you will have to pop every element to find which one is the max.


https://hastebin.com/qazenuqera.cpp here's my code, but not sure if it's right