Tag: Priority Queue

Huffman Coding

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.  

Min Heap and Max Heap Implementation in Java

Implement Heap data structure in Java.     We have already introduced heap data structure in previous post and covered heapify-up, push, heapify-down and pop operations. In this post, java implementation of Max Heap and Min heap is discussed.   1. Max Heap implementation in Java –   Below is java implementation of Max Heap …

External Sorting (External merge sort)

External sorting is a term for a class of sorting algorithms that can handle massive amounts of data. External sorting is required when the data being sorted do not fit into the main memory of a computing device (usually RAM) and instead they must reside in the slower external memory (usually a hard drive).

Sort K-Sorted 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.