Given an n x n matrix, where every row and column is sorted in non-decreasing order. Find the kth smallest element in the given 2D… Read More
Category Archives: Heap
VMWare interview for MTS-2 position. I Telephonic round 1. Given an array of strings. Find the maximum prefix among all the strings. Ans: First told… Read More
Given K sorted arrays of size N each, merge them and print the sorted output. Examples: Input: K = 3, N = 4, arr = {… Read More
First of all, a very very big thanks to whole team of geeks for geeks. It is because of them only that I was able… Read More
Pre-requisite: What is Heap Sort? Heapsort is a comparison-based sorting technique based on a Binary Heap data structure. It is similar to selection sort where… Read More
Heap sort is a comparison-based sorting technique based on the Binary Heap data structure. It is similar to the selection sort where first find the… Read More
Heap sort is a comparison-based sorting technique based on the Binary Heap data structure. It is similar to the selection sort where we first find… Read More
To design an efficient data structure for a specific set of operations, it’s important to consider the time and space complexity of different data structures… Read More
Huffman coding is a lossless data compression algorithm. The idea is to assign variable-length codes to input characters, lengths of the assigned codes are based… Read More
Given N machines. Each machine contains some numbers in sorted form. But the amount of numbers, each machine has is not fixed. Output the numbers… Read More
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
Consider the following algorithm for building a Heap of an input array A. BUILD-HEAP(A) heapsize := size(A); for i := floor(heapsize/2)… Read More
Given an array and an integer K, find the maximum for each and every contiguous subarray of size K. Examples : Input: arr[] = {1,… Read More