Given M sorted lists of variable length, efficiently compute the smallest range that includes at-least one element from each list.
Given an array and positive integer k, find k’th smallest element in the array.
Given a k-sorted array that is almost sorted such that each of the N elements may be misplaced by no more than k positions from the correct sorted order. Find a space-and-time efficient algorithm to sort the array.
Given an array and positive integer k, find K’th largest element in the array.
Given an array representing a Max Heap, in-place convert the array into the min heap in linear time.
Given an array of integers, check if it represents min heap or not.
Given an array of integers, sort it using heap sort algorithm in C, C++ and Java.
Given an array of positive integers which can be partitioned into three disjoint subsets having same sum and that covers S, print the partitions.
Implement heap data structure.
In this article, we will introduce a very important data structure Priority Queues and discuss how we can implement them using (Binary) Heaps.
A stack is a linear data structure that serves as a collection of elements, with three main operations:
Given a set of tasks with deadlines and total profit earned on completion of a task, find maximum profit earned by executing the tasks within the specified deadlines. Assume any task will take one unit of time to execute and any task can’t execute beyond its deadline. Also, only one task can be executed at …