- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Meldable DEPQs

- A meldable DEPQ (MDEPQ) is defined as a DEPQ (Double Ended Priority Queue) that, in addition to the DEPQ operations listed above, includes the operation meld(p, q) ... meld the DEPQs p and q into a single DEPQ. The result of melding the double-ended priority queues p and q is a single double-ended priority queue that contains all elements of p and q. The meld operation is destructive in that following the meld, p and q do not remain as independent DEPQs.
- To meld two DEPQs in less than linear time, it is necessary that the DEPQs be represented implementing explicit pointers (rather than implicit ones as in the array representation of a heap) as otherwise a linear number of elements necessary to be moved from their initial to their ﬁnal locations.
- It can be shown that when the min-max pair heap is represented in such a way, an element (size of n) DEPQ may be melded with another element(size of k) (where k<=n) in O(log(n/k)*log k) time.
- It can be shown that the complexity of melding two min-max heaps of size a and b, respectively, is Ω(a + b).
- An MDEPQ implementation that permits one to calculate the min and max elements, insert an element, and meld two priority queues in O(1) time. The time required to delete the minimum or maximum element is O(log n).
- It can be shown that leftist trees may be adapted to get a simple representation for MDEPQs in which meld consumes logarithmic time and the remaining operations have the same asymptotic complexity as when any of the aforementioned DEPQ representations is implemented.
- It is interesting to note that if we implement the FMPQ (Fast Meldable Priority Queue) structure of as the base MPQ structure, we obtain a total correspondence MDEPQ structure in which removeMax and removeMin consume logarithmic time, and the remaining operations consume constant time. This adaptation is excellent as compare to the dual priority queue adaptation because the space requirements are almost half. Additionally, the total correspondence adaptation is faster than dual priority queue adaptation.

- Related Questions & Answers
- Generic Methods for DEPQs
- Meldable Priority Queue Operations
- Meldable Priority Queues and Skew Heaps

Advertisements