Given a directed acyclic graph (DAG), print it in Topological order using Kahn’s Topological Sort algorithm. If the DAG has more than one topological ordering, print any of them.
In this post, we will see how to sort an array of integers using iterative merge sort algorithm. Merge sort is an efficient sorting algorithm which falls under divide and conquer paradigm and produces a stable sort.
Quickselect is a selection algorithm to find the kth smallest element in an unordered list. It is closely related to the quicksort sorting algorithm.
Implement Quicksort algorithm using Hoare’s Partitioning scheme.
Given a collection of n items, each of which has a non-negative integer key whose maximum value is at most k, effectively sort it using counting sort algorithm.
Implement Quicksort efficiently for inputs containing many repeated elements.
In this article, we will implement Ternary Search algorithm and compare its performance with Binary Search.
In this post, we will implement KMP Algorithm in C, C++ and Java programming language.
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 an array of integers, find contiguous subarray within it which has the largest sum.
Given an array of integers containing duplicates, return the majority element in an array if present. A majority element appears more than n/2 times where n is the size of the array.
Given a binary tree, write iterative and recursive solution to traverse the tree using in-order traversal. Unlike linked lists, one-dimensional arrays and other linear data structures, which are traversed in linear order, trees may be traversed in multiple ways in depth-first order (in-order, pre-order and post-order) or breadth-first order (level order traversal). Beyond these …