## K’th Least Element in a Min-Heap

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 »

## Maximums from array when the maximum decrements after every access

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 »

## Find the k smallest numbers after deleting given elements

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 »

## Find the k largest numbers after deleting the given elements

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 »

## Sort the path from root to a given node in a Binary Tree

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 »

## Sort a nearly sorted array using STL

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 »

## priority_queue value_type in C++ STL

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 »

## Priority queue of pairs in C++ (Ordered by first)

In C++, priority_queue implements heap. Below are some examples of creating priority queue of pair type. Max Priority queue (Or Max heap) ordered by first… Read More »

## Kth smallest element after every insertion

Given an infinite stream of integers, find the k’th largest element at any point of time. It may be assumed that 1 <= k <=… Read More »

## Merge k sorted arrays | Set 2 (Different Sized Arrays)

Given k sorted arrays of possibly different sizes, merge them and print the sorted output. Examples: Input: k = 3 arr[][] = { {1, 3},… Read More »

## Does STL priority queue allow duplicate values?

Yes, in C++ priority_queue, we may have duplicate values. filter_none edit close play_arrow link brightness_4 code // C++ program to demonstrate that duplicate // values… Read More »

## STL Priority Queue for Structure or Class

STL priority_queue is the implementation of Heap Data-structure.. By default, it’s a max heap and we can easily use it for primitive datatypes. There are… Read More »

## Minimum increment/decrement to make array non-Increasing

Given an array a, your task is to convert it into a non-increasing form such that we can either increment or decrement the array value… Read More »

## Next greater number on the basis of precedence of digits

Given a number num containing n digits. The problem is to find the next greater number using the same set of digits in num on… Read More »

## Print Binary Tree levels in sorted order

Given a Binary tree, the task is to print its all level in sorted order Examples: Input : 7 / \ 6 5 / \… Read More »