Given array representation of min Heap, convert it to max Heap in O(n) time.
Example :
Input: arr[] = [3 5 9 6 8 20 10 12 18 9]
3
/
5 9...
Share
Given the level order traversal of a Complete Binary Tree, determine whether the Binary Tree is a valid Min-Heap
Examples:
Input : level = [10, 15, 14, 25, 30]
Output...
Share
Question: Write an efficient program for printing k largest elements in an array. Elements in array can be in any order.
For example, if given array is [1, 23, 12, 9...
Share
In previous article, we have discussed about the concepts related to Binomial heap.
Examples Binomial Heap:
12------------10--------------------20
/ ...
Share
A typical Priority Queue requires following operations to be efficient.
Get Top Priority Element (Get minimum or maximum)
Insert an element
Remove top priority elem...
Share
Although QuickSort works better in practice, the advantage of HeapSort worst case upper bound of O(nLogn).
MergeSort also has upper bound as O(nLogn) and works bette...
Share
Heap data structure can be implemented in a range using STL which allows faster input into heap and retrieval of a number always results in the largest number i.e. la...
Share
How to Implement stack using a priority queue(using min heap)?.
Asked In: Microsoft, Adobe.
Recommended: Please try your approach on {IDE} first, before moving on t...
Share