# Tag: Algorithm

## Quicksort using Dutch National Flag Algorithm

Implement Quicksort efficiently for inputs containing many repeated elements.     Quicksort exhibits poor performance for inputs that contain many repeated elements. The problem is clearly visible when all the input elements are equal. Then at each recursion, the left partition is empty (no input values are less than the pivot), and the right partition …

Read More Quicksort using Dutch National Flag Algorithm

## Ternary Search vs Binary search

In this article, we will implement Ternary Search algorithm and compare its performance with Binary Search.

Read More Ternary Search vs Binary search

## Huffman Coding

Huffman Coding 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.

## Merge Sort for Singly Linked List

Given a linked list, sort it using merge sort algorithm.     Merge sort is an efficient, general-purpose sorting algorithm which produces a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output. Mergesort is a comparison sort, i.e. it can sort items of any type for …

## Run Length Encoding (RLE) data compression algorithm

Run length encoding (RLE) is a very simple form of lossless data compression which runs on sequences having same value occurring many consecutive times and it encode the sequence to store only a single value and its count.

Read More Run Length Encoding (RLE) data compression algorithm

## Exponential search

Given a sorted array of integers and a target value, find out if a target exists in the array or not in O(log(n)) time. If target exists in the array, print index of it.

## Interpolation search

Given a sorted array of integers and a target, find out if a target exists in the array or not. If target exists in the array, print index of it.

## Binary Search

Given a sorted array of integers and a target value, find out if a target exists in the array or not in O(log(n)) time. If target exists in the array, print index of it.

## Lee algorithm | Shortest path in a Maze

Given a maze in the form of the binary rectangular matrix, find length of the shortest path in a maze from given source to given destination. The path can only be constructed out of cells having value 1 and at any given moment, we can only move one step in one of the four directions.

Read More Lee algorithm | Shortest path in a Maze

## 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).