Convert Min Heap to Max Heap in O(n) time
Given an array representing a Min Heap, convert Min Heap into a Max Heap. The conversion should be done inplace and in linear time. Get great deals at Amazon
Coding made easy
Given an array representing a Min Heap, convert Min Heap into a Max Heap. The conversion should be done inplace and in linear time. Get great deals at Amazon
Given M sorted lists of variable length, print them in sorted order efficiently.
Huffman Coding (also known as Huffman Encoding) is a algorithm for doing data compression and it forms the basic idea behind file compression. This post talks about fixed length and variable length encoding, uniquely decodable codes, prefix rules and construction of Huffman Tree.
Given a string, find first K non-repeating characters in it by doing only single traversal of it.
Implement Heap data structure in Java.
We can efficiently sort massive amounts of data using External Merge Sort Algorithm, when the data being sorted don’t fit into the main memory (which is usually RAM) and resides in the slower external memory (which is usually a hard disk).
Given M sorted lists each containing N elements, print them in sorted order efficiently.
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.