Category Archives: Heap

Given an array arr[] of size N, consisting of 0s initially, and a positive integer K, the task is to print the array elements by… Read More
Given an array arr[] of size N, the task is to find the smallest possible remaining array element by repeatedly removing a pair, say (arr[i],… Read More
Given an array A[] consisting of N integers, the task is to find the minimum difference between the largest and the smallest element in the… Read More
Given an array arr[] consisitng of N integers and an integer K, the task is to find the Kth smallest element in the array using… Read More
Given an array arr[] consisting of N integers and three integers X, Y, and K, the task is to find the farthest index that can… Read More
A Heap is a special Tree-based data structure in which the tree is a complete binary tree. Since a heap is a complete binary tree,… 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
Given two arrays A[] and B[] consisting of N integers, the task is to update array A[] by assigning every array element A[i] to a… Read More
Given two sorted arrays, arr[], brr[] of size N, and M, the task is to merge the two given arrays such that they form a… Read More
Given an array arr[] consisting of N positive integers, and an integer K, the task is to find the maximum possible even sum of any… Read More
Given two arrays arr1[] and arr2[] of lengths N and M respectively, the task is to find the maximum number of pairs (i, j) such… Read More
Given an array arr[] consisting of N positive integers and an integer K. In one operation, select an array element, add it to the sum… Read More
Given an array of intervals arr[] of size N, the task is to find the Kth smallest element among all the elements within the intervals… Read More
Given a Binary Search Tree, the task is to print the nodes of the BST in the following order: If the BST contains levels numbered… Read More
Given a two dimensional array arr[][] of dimensions N * 2 which contains the starting and ending time for N meetings on a given day.… Read More