As it is good known, elements which are inserted to the priority queue have a value which determines its priority. For example if I have five elements A,B,C,D,E
with priorities (let's call this priority values priorityI
):
A = 10, B = 5, C = 1, D = 3, E = 2
.
But how can I write a priority queue where I can define two priority values, I mean:
if two elements has the same value of priorityI
, then value priorityII
decides which element should be taken first, like for example:
element A has priorityI = 3, and prioriotyII = 5
element B has priorityI = 3, and prioriotyII = 1
then first element B will be taken from the queue first.