Recent questions tagged priority-queue

1 1 vote
1 1 answer
102
102 views
Suppose Huffman coding is implemented as follows.Initially, the $n$ symbols are stored in a min priority queue according to their frequencies.The algorithm repeatedly per...
7 7 votes
1 1 answer
442
442 views
Which of the following statements are true?$\text{S1.}$ Stack operations $\texttt{push}$, $\texttt{pop}$, and $\texttt{isEmpty}$ can be worst-case $O(1)$ for a linked-lis...
4 4 votes
1 1 answer
162
162 views
Consider the following min-heap where each node is written as $\texttt{(value, priority)}$:Now perform these operations in order:$\texttt{updatePriority(A, 8)}$ $\texttt{...
4 4 votes
4 4 answers
1.7k
1.7k views
In a priority queue, insertion and deletion can be done atFrontBackMiddleAny position 
27 27 votes
3 3 answers
16.8k
16.8k views
Let $A$ be a priority queue for maintaining a set of elements. Suppose $A$ is implemented using a max-heap data structure. The operation $\text{EXTRACT-MAX} (A)$ extracts...
0 0 votes
1 1 answer
614
614 views
Q.which of the following data structure cannot be used for efficient implementation of Priority Queue?a. Binary heapb. Height balanced binary tree.c. Sorted array
0 0 votes
3 3 answers
1.5k
1.5k views
What is the worst case running time of Insert and Extract-min, in an implementation of a priority queue using an unsorted array? Assume that all the insertions can be acc...
2 2 votes
2 2 answers
1.5k
1.5k views
A priority queue is implemented as a Max-Heap. Initially, it has $5$ elements. The level-order traversal of the heap is: $10,8,5,3,2$. Two new elements $1$ and $7$ are in...
0 0 votes
0 0 answers
624
624 views
Show how to implement a first-in, first-out queue with a priority queue. Show how to implement a stack with a priority queue.
0 0 votes
0 0 answers
982
982 views
Is priority queue work efficiently with sorted array than unsorted array and heap for insertion and deletion operation? Then why do we apply priority queue in heap specia...
0 0 votes
2 2 answers
1.3k
1.3k views
0 0 votes
1 1 answer
1.7k
1.7k views
On other sources, it is given that we need to assign high priorities to newly inserted element in case of stack otherwise low priority to newly inserted element in case o...
1 1 vote
1 1 answer
2.2k
2.2k views
A priority queue is implemented as a $Max$-$heap.$Initially, it has $5$ elements. The level order traversal of the heap is $10,8,5,3,2.$ Two new elements $1$ and $7$ are ...
2 2 votes
1 1 answer
1.8k
1.8k views
Suppose Stack operations are implemented using Queue Operation. Push(x) and Pop() are stack operations whereas enqueue(x) and dequeue are Queue operations.Consider the co...
2 2 votes
1 answers 1 answer
2.5k
2.5k views
Fill in the blanks in the procedure:void Prod (Element Type X, Priority Queue H) { int i; if (IsFull(H)) { Error ("Priority queue is full"); return; } for (i=++H - size; ...
0 0 votes
1 1 answer
1.3k
1.3k views
How to implement Priority queue using stack?What will be time complexity for Enqueue and Dequeue operations?Edit:- Updated the question clearly
5 5 votes
4 answers 4 answers
2.2k
2.2k views
A stack is used to implement a priority queue where $ENQUEUE(Q, x, p)$ ($p$ denotes priority, higher the better) and $DEQUE(Q)$ are implemented by appropriate PUSH and PO...
1 1 vote
1 1 answer
2.9k
2.9k views
A priority queue is implemented as a max-heap. Initially, it has five elements. The levelorder traversal of the heap is as follows :20, 18, 15, 13, 12Two new elements ‘10...
0 0 votes
2 2 answers
8.1k
8.1k views
What is the most appropriate data structure to implement a priority queue ?HeapCircular arrayLinked listBinary tree
1 1 vote
1 1 answer
2.2k
2.2k views
How many minimum queues are required to implement a priority queue?
73 73 votes
5 answers 5 answers
38.6k
38.6k views
A priority queue $Q$ is used to implement a stack that stores characters. PUSH (C) is implemented as INSERT $(Q, C, K)$ where $K$ is an appropriate integer key chosen by ...
To see more, click for the full list of questions or popular tags.