Given an array arr[] consisting of N integers, the task is to find the maximum number of pairs of array elements such that each pair… Read More

# Tag Archives: Data Structures-Heap

Given a positive integer N, the task is to find the largest and smallest elements, from the maximum leaf nodes of every possible binary max-heap… Read More

Binary Heap:A Binary Heap is a Binary Tree with following properties. It’s a complete binary tree i.e., all levels are completely filled except possibly the… Read More

Prerequisites: Binary heap data structure heapq module in Python Dictionary in Python. The dictionary can be maintained in heap either based on the key or… Read More

Heaps are widely used tree-like data structures in which the parent nodes satisfies any one of the criteria given below. The value of the parent… Read More

Prerequisite: heapq module The heapq module has several functions that take the list as a parameter and arranges it in a min-heap order. The problem… Read More

Priority Queue is an extension of the queue with the following properties: Every item has a priority associated with it. An element with high priority… Read More

Given an array of integers arr[] consisting of N integers, the task is to minimize the sum of the given array by performing at most… Read More

Given an array of N elements which denotes the array representation of binary heap, the task is to find the leaf nodes of this binary… Read More

A Min Heap is a Complete Binary Tree in which the children nodes have a higher value (lesser priority) than the parent nodes, i.e., any… Read More

A data structure is a particular way of organizing data in a computer so that it can be used effectively. In this article, the real-time… Read More

Given an array arr size N, the task is to print the final array value remaining in the array when the maximum and second maximum… Read More

Given N elements, you can remove any two elements from the list, note their sum, and add the sum to the list. Repeat these steps… Read More

Prerequisites: Fibonacci Heap (Introduction) Fibonacci Heap is a collection of trees with min-heap or max-heap property. In Fibonacci Heap, trees can have any shape even… Read More