Tag Archives: priority-queue

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 a character array, str[] of consisting of N lowercase alphabets, and an integer array, arr[] consisting of numbers in the range [0, N –… Read More
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 A[] consisting of N integers, the task is to find the minimum difference between the largest and the smallest element in the… Read More
Given an array arr[] consisting of N integers and three integers X, Y, and K, the task is to find the farthest index that can… Read More
Given string str, the task is to find the minimum count of characters that need to be deleted from the string such that the frequency… Read More
Given an integer N, a binary string S and an array W[]. S denotes the sequence of N * 2 persons entering the hall, where… Read More
Given two arrays A[] and B[] consisting of N integers, the task is to update array A[] by assigning every array element A[i] to a… Read More
Given M servers that handle multiple requests having infinite computational capability and arrays arrivalTime[] and processTime[] of size N denoting the arrival time and load… Read More
Given a binary string, str, two integer arrays R[], and C[] of size N. Flipping all the characters from index i to R[i] requires C[i]… Read More
Given an array arr[] consisting of N positive integers and an integer K. In one operation, select an array element, add it to the sum… 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 matrix m[][] of dimensions N × M and an integer K, calculate XOR(i, j) which is equal to the Bitwise Xor of all… Read More
Heaps are widely used tree-like data structures in which the parent nodes satisfies any one of the criteria given below. The value of the parent… Read More