A priority queue is implemented using a linked list.
typedef struct node {
int value;
int priority;
struct node* next;
} Node;
The lower number indicates higher priority. Function void push(Node** head, int data, int pri) inserts an element in the list according to its priority. If queue contains 1, 5, 4, 7 with priority value 3, 6, 8, 9 respectively. If a new element 10 with priority 2 arrives then which of the following condition must be satisfied tor the enqueue operation?1
if ((*head)->priority > pri)
{
temp->next = *head;
(*head) = temp;
}2
if ((*head)->priority < pri)
{
temp->next = *temp;
(*head) = temp;
}3
if ((*head)->pri > priority)
{
temp->next = *head;
(*head) = temp;
}4
if ((*head)->priority > pri)
{
temp->next = *temp;
(*temp) = head;
}