L5-MinmaxHeap-S07[1]

# L5-MinmaxHeap-S07[1] - Double-Ended Priority Queues(DEQUE...

This preview shows pages 1–3. Sign up to view the full content.

1 Double-Ended Priority Queues (DEQUE) Recall that PQ supports insert(x,Q) and deletemin(Q) or deletemax(Q) operations. Q: How do we design an ADT that will support both deletemin(Q) and deletemax(Q) operations? Minmax Heap (Atkinson, Sack, Santoro, Strothotte, 1986): A minmax heap H is an extension of 2-heap by fusing a min heap and a max heap together. There are two types of nodes in H: min node and max node. Each node x in H is either a min node , x is all its descendants, or a max node, x is all its descendants, and all the nodes in the same level must be of the same type. A min-level (max-level) in H is a collection of all the min (max) nodes having the same level number. Dfn. A minmax heap is a tree satisfying the following properties: 1. Structural Property : H is a complete binary tree. 2. Relational Property : H s atisfies the minmax heap property with which, starting at the root at min-level, nodes are alternating between min-level and max- level. Example: A minmax heap H.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 7 min-level 75 65 max-level 36 48 12 58 min-level 65 38 56 58 12 62 max-level HW: Define maxmin heap. Implementation: Sequential array implementation with root of H at A[1]. Example: Array implementation of H. l a s t m a x Q 0 1 2 7 75 65 36 48 12 58 65 38 56 58 12 62 … Minmax heap operations: Two-step process as in binary heap: 1. Maintain complete binary tree structure after each insert/delete operation. 2.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 9

L5-MinmaxHeap-S07[1] - Double-Ended Priority Queues(DEQUE...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online