+ 1
Queues
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?
2 odpowiedzi
+ 1
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.
0
https://hastebin.com/qazenuqera.cpp
here's my code, but not sure if it's right