# Tag Archives: min-heap

Given an integer M and a sorted integer array arr[] of length N containing 1 and N-1 prime numbers, each appearing just once, the task… Read More
Given an integer N and an array arr[] of M pairs of type (Ai, Bi), the task is to generate the lexicographically smallest possible permutation… Read More
Given a positive integer K and a weighted undirected connected graph of N nodes and E edges as an array Edges[] of the type {u,… Read More
Given an array arr[] consisting of N integers and an array Query[][] consisting of M pairs of the type {L, R}, the task is to… Read More
Given three arrays X[], Y[], and Z[] each consisting of N integers, the task is to find the maximum number of triplets (X[i], Y[i], Z[i])… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to split the given array into K non-overlapping subsets such… Read More
Given a matrix arr[][] of dimension M*N consisting of positive integers, where arr[i][j] represents the height of each unit cell, the task is to find… Read More
Given an integer N, representing number of projects, two arrays P[] and C[], consisting of N integers, and two integers W and K where, W… Read More
Given a 2D array arr[][3] consisting of information of N trains where arr[i][0] is the train number, arr[i][1] is the arrival time, and arr[i][2] is… 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
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 two dimensional array arr[][] of dimensions N * 2 which contains the starting and ending time for N meetings on a given day.… 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 integer N denoting number of jobs and a matrix ranges[] consisting of a range [start day, end day] for each job within which… Read More
Given a positive integer M and two arrays arr[] and value[] of N and K positive integers respectively, the task is to add every element… Read More