- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Min-Max Heaps
A min-max heap is defined as a complete binary tree containing alternating min (or even) and max (or odd) levels. Even levels are denoted as for example 0, 2, 4, etc, and odd levels are denoted as 1, 3, 5, etc.
We consider in the next points that the root element is at the first level, i.e., 0.
Example of Min-max heap
Features of Min-max heap
- Each node in a min-max heap is associated with a data member (usually called key) whose value is implemented to calculate the order of the node in the min-max heap.
- The root element is the minimum element in the min-max heap.
- One of the two elements in the second level, which is a max (or odd) level, is the maximum element in the min-max heap
- Let y be any node in a min-max heap.
- If y is on a min (or even) level, then y.key is the smallest key among all keys in the subtree with root y.
- If y is on a max (or odd) level, then y.key is the highest key among all keys in the subtree with root y.
- A node on a min (max) level is denoted as a min (max) node.
A max-min heap is defined as opposite to min-max heap; in such a heap, the highest value is stored at the root, and the minimum value is stored at one of the root's children.
- Related Articles
- Symmetric Min-Max Heaps
- Removing the Min Element from Interval Heaps
- Merge two binary Max Heaps using C++.
- max() and min() in Python
- Perform min/max with MongoDB aggregation
- Use of min() and max() in Python
- Sorting max to min value in MySQL
- Average of array excluding min max JavaScript
- Convert min Heap to max Heap in C++
- Minimum removals from array to make max – min
- Find Min-Max in heterogeneous list in Python
- Min-Max Range Queries in Array in C++
- How to use min and max attributes in HTML?
- Min and max values of an array in MongoDB?
- Program to fill Min-max game tree in Python

Advertisements