Skip to content

# Tag Archives: cpp-priority-queue

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 weighted graph of N nodes and M edges in the form of a tuple lets say {X, Y, Z} such that there… 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
Given an unsorted array and two numbers x and k, find k closest values to x.Examples:   Input : arr[] = {10, 2, 14, 4, 7,… 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
Given a Binary tree, the task is to sort the particular path from to a given node of the binary tree. You are given a… Read More
Given an array of n elements, where each element is at most k away from its target position, devise an algorithm that sorts in O(n… Read More
The priority_queue :: value_type method is a builtin function in C++ STL which represents the type of object stored as an element in a priority_queue.… Read More