option A vs option D
https://en.wikipedia.org/wiki/Priority_queue
In a stack, the priority of each inserted element is monotonically increasing; thus, the last element inserted is always the first retrieved. In a queue, the priority of each inserted element is monotonically decreasing; thus, the first element inserted is always the first retrieved.
Explanation :- A priority queue works on the bases of it's element's priority , it doesn't do operation in FIFO or LIFO manner like normal queue and stack do. Like here we defined some operation like DELETEMIN(Q) , so this abstract data structure will help to delete minimum priority element from priority queue , noe it doesn't matter in which order the element are inserted.
like if elements are like 5,3,2,7,8 DELETEMIN(Q) will delete 2 (see no FIFO).We have to here implement stack using Priority queue (although practically it's not a good approach to implement stack using priority queue)so here element must follow LIFO mechanism. Now if elements are in strictly decreasing order we can implement stack using priority queue successfully but when elements are repeated (non-increasing order) then our priority queue will behave like a normal queue and it will follow FIFO approach but to implement stack element have to follow LIFO approach , which won't be possible.
elements : $3_{a} , 3_{b},3_{c},3_{d}$ // all elements are same , to take care about order of insertion i named them like $3_{a} , 3_{b}$ and so on...
Here i'm taking the help of https://www.geeksforgeeks.org/implement-stack-using-priority-queue-or-heap/
to implement stack using priority queue. the key concept is add a count to each variable which will indicate when the element was inserted (think like time)
$3_{a}$ is pushed into stack at t=1
$3_{b}$ is pushed into stack at t=2
$3_{c}$ is pushed into stack at t=3
$3_{d}$ is pushed into stack at t=4
we implement PUSH as
push_stack(data)
{
t++;
PQ.push(pair(t,data));
}
So stack is like
$3_{d}$ (t=4) |
$3_{c}$ (t=3) |
$3_{b}$ (t=2) |
$3_{a}$ (t=1) |
We implement POP as
pop_stack(data)
{
t--;
PQ.pop();
}
So we can see the first element the PQ.pop() will pop is on the bases on FIFO order and it would be $3_{a}$ but it's not what stack will pop (stack would have to follow LIFO so it would have to pop $3_{d}$) so that's why option A would be false.