codeintuition-logo

Overview of supported operations


Now that we know what a heap is and how it keeps track of the highest-priority data item, we can dive a bit deeper and understand the different operations that can be performed on it. Every data structure has its special powers, and for a heap, it is ultra-fast insertion and extraction of the highest-priority data item. The primary operations on a heap and their high-level workings are given below.

Insert

The insert operation is one of the primary operations on a heap and is used to insert a data item and its associated priority. A new node with the given priority is created and added to the tree. If the new data item has the highest priority in the dataset, it makes its way to the root of the tree at the end of the operation.

Liking the course? Check our discounted plans to continue learning.