Heap / Priority Queue

Heap / Priority Queue

Learn heap operations and priority queue applications

9 Problems
Advanced
Watch Playlist

All Problems

9 problems
1
Kth Smallest Element
Given an array of n integers, find the kth smallest element in the array.
Easy
Not Attempted
Video
2
Kth Largest Element
Given an array of n integers, find the kth largest element in the array.
Easy
Not Attempted
Video
3
Sort a K-Sorted Array
Given a k-sorted array, which is an array where each element is at most k positions away from its sorted position, sort the array.
Medium
Not Attempted
Video
4
K Closest Numbers
Given a sorted array, a number X, and a value k, find the k closest numbers to X in the array.
Medium
Not Attempted
Video
5
Top K Frequent Numbers
Given a non-empty array of integers, return the k most frequent elements.
Medium
Not Attempted
Video
6
Frequency Sort
Given an array of integers, sort the array in increasing order based on the frequency of the numbers. If multiple numbers have the same frequency, sort them in increasing order.
Medium
Not Attempted
Video
7
K Closest Points to Origin
Given a list of points on a 2D plane, find the K closest points to the origin (0, 0). There can be multiple Solutions, Give any solution out of multiple solutions
Medium
Not Attempted
Video
8
Connect Ropes to Minimise the Cost
Given n ropes of different lengths, connect them into a single rope with the minimum possible cost. The cost to connect two ropes is equal to the sum of their lengths.
Easy
Not Attempted
Video
9
Sum of Elements between k1'th and k2'th smallest elements
Given an array of integers and two integers k1 and k2, find the sum of all elements between the k1'th and k2'th smallest elements of the array.
Easy
Not Attempted
Video