Given an integer N, representing the number of workers, an array speed[ ], where speed[i] represents the speed of the ith worker, and an array efficiency[… Read More

# Tag Archives: cpp-priority-queue

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

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 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

STL Priority Queue is the implementation of Heap Data Structure. By default, it’s a max heap, and can be easily for primitive data types. There… 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 arr[] consisting of N integers and an integer K, the task is to find the Kth smallest element in the array using… 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 arr[] of size, N. Find the maximum number of triplets that can be made using array elements such that all elements in… Read More

Given an undirected graph of N nodes and M edges of the form {X, Y, Z} such that there is an edge between X and… Read More

C++ // C++ code #include <iostream> #include <utility> using namespace std; int main() { // Declaring the PAIR1 of int and char // IF… 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

Priority Queue: Priority queue is the extension of the queue in which elements associated with priority and elements having higher priority is popped first. Priority… Read More

Priority Queue in STL Priority queues are a type of container adapters, specifically designed such that the first element of the queue is the greatest… Read More