- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Insertion into a Max Heap in Data Structure
Here we will see how to insert and elements from binary max heap data structures. Suppose the initial tree is like below −
Insertion Algorithm
insert(heap, n, item) − Begin if heap is full, then exit else n := n + 1 for i := n, i > 1, set i := i / 2 in each iteration, do if item <= heap[i/2], then break heap[i] = heap[i/2] done end if heap[i] := item End
Example
Suppose we want to insert 30 into the heap −
- Related Articles
- Insertion Into a Max HBLT in Data Structure
- Deletion from a Max Heap in Data Structure
- Binary Heap in Data Structure
- B-tree Insertion in Data Structure
- B+ tree Insertion in Data Structure
- Deletion of Max Element from a Max HBLT In Data Structure
- Max WBLT Operations in Data Structure
- Insertion in the Red Black Tree in Data Structure
- Melding Two Max HBLTs in Data Structure
- Max Heap in Java
- Convert min Heap to max Heap in C++
- Is Max Heap in Python?
- Minimum element in a max heap in C++.
- Deletion of Arbitrary Element from a Max HBLT in Data Structure
- Convert BST to Max Heap in C++

Advertisements