Skip to content

Category Archives: Heap

Given an array arr[] consisting of N pairs and a positive integer M, the task is to maximize the average of the ratio of the… Read More
Given an array arr[] consisting of N integers, the task is to find the length of the longest subsequence such that the prefix sum at… Read More
1. Binary Search Tree :An acyclic graph is commonly used to illustrate a Binary Search Tree. The tree is made up of nodes. Each node… Read More
Given an array arr[] consisting of N positive integers such that arr[i] represents that the ith bag contains arr[i] diamonds and a positive integer K,… Read More
Given an array arr[] consisting of N positive integers, such that arr[i] represents the number of products the ith supplier has and a positive integer,… Read More
Given a positive integer K and an array arr[] consisting of N positive integers, such that arr[i] is the number of processes ith processor can… Read More
Given a sorted 2D array arr[][2] of size N such that (arr[i][0], arr[i][1]) represents the coordinates of ith point in the cartesian plane and an… 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
Given an array arr[] consisting of N integers representing N transactions, the task is to merge the given lists of transactions in the order of… Read More
Given an integer K denoting the fuel tank capacity of a car running at the cost of 1 liter / mtr on a straight path… Read More
A leftist heap is a priority Queue implemented with a binary heap. Every node has a sValue which is at the nearest Distance to the… Read More
Given an array arr[] consisting of N distinct elements, the task is to find the maximum number of pairs required to be decreased by 1… Read More
Given an array arr[] and an integer K, the 0th index, the task is to collect the maximum score possible by performing the following operations:  … Read More
Given two arrays apples[] and days[] representing the count of apples an apple tree produces and the number of days these apples are edible from… Read More