# Tag Archives: priority-queue

Given an array arr[] of size N and a number K, the task is to find the length of the smallest subsequence such that the… Read More
Prerequisite: Greedy Algorithms | Set 3 (Huffman Coding), priority_queue::push() and priority_queue::pop() in C++ STL Given a char array ch[] and frequency of each character as freq[].… Read More
Given array seats[] where seat[i] is the number of vacant seats in the ith row in a stadium for a cricket match. There are N… Read More
Given an integer N and an array seats[] where N is the number of people standing in a line to buy a movie ticket and… Read More
Given a binary array arr[], the task is to design a data structure that supports the following operations in O(1).   Type 1: Remove and print… Read More
Given an array arr[] of N non-zero positive integers and an integer K, the task is to find the XOR of the K largest prime… Read More
Given an array arr[] consisting of the cost of toys and an integer K depicting the amount of money available to purchase toys. The task… Read More
Given an array of length N. The task is to convert it into a sequence in which all elements are greater than or equal to… Read More
Given an array of integers. The task is to rearrange elements of the array such that no two adjacent elements in the array are same.… Read More
Given an array arr[] of N integers and an integer X, the task is to find the maximum possible sub-array sum after applying at most… Read More
Given an array arr[] of N integers from 1 to N. The task is to perform the following operations N – 1 times.   Select two… Read More
Given an array of strings and an array of integers where ith integer of the array corresponds to the value of the ith string present… Read More
Given a connected graph with N vertices and M edges. The task is to find the shortest path from source to the destination vertex such… Read More
Given N elements, you can remove any two elements from the list, note their sum, and add the sum to the list. Repeat these steps… Read More
Given a connected graph with N vertices and M edges. The task is to print the lexicographically smallest BFS traversal of the graph starting from… Read More