importance of container class in priority_queue | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

importance of container class in priority_queue

Hello All As we know, priority_queue has data type, container and comparator as argument. For example, priority_queue<int,vector<int>,less<int>>. I do understand usage and use case of comparator, but getting confused with container. In which cases, default container should not be used for priority_queue?

9th Nov 2020, 7:06 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Respuesta
0
Yeah that's true... What makes me think is priority_queue is interface for us and it doesn't matter whether container is queue or vector , methods of priority queue doesn't change.... So , in what cases we are recommended to use different container class for priority_queue
10th Nov 2020, 5:23 AM
Ketan Lalcheta
Ketan Lalcheta - avatar