Tag Archives: cpp-priority-queue

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 arr[] consisitng 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++ filter_none edit close play_arrow link brightness_4 code // C++ code #include <iostream> #include <utility> using namespace std;   int main() {     // Declaring the… 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
Given an unsorted array and two numbers x and k, find k closest values to x. Examples: Input : arr[] = {10, 2, 14, 4,… Read More
Given a min-heap of size n, find the kth least element in the min-heap. Examples: Input : {10, 50, 40, 75, 60, 65, 45} k… Read More
Given an integer K and an array of integers arr, the task is to find the maximum element from the array and after every retrieval… Read More
Given an array of integers, find the k smallest numbers after deleting given elements. In case of repeating elements delete only one instance in the… Read More
Given an array of integers, find the k largest number after deleting the given elements. In case of repeating elements, delete one instance for every… Read More