In this tutorial, we’ll be discussing and implementing the Huffman Coding Algorithm in Java. Huffman Coding The Huffman Coding Algorithm was discovered by David A. Huffman in the 1950s. The purpose of the Algorithm is lossless data compression. This algorithm is commonly used in JPEG Compression. Now traditionally to encode/decode a string, we can use […]

Data Structure and Algorithms are the building blocks of computer programming. A well-defined data structure helps us in keeping our data organized. Some of the commonly used data structures are List, Queue, Stack, Tree etc.

The algorithms provide different ways to achieve a task on these data structures. Some of the common algorithms are in the area of sorting and searching elements in the data structure.

## Binary Search Tree (BST) – Search Insert and Remove

In this tutorial, we’ll be discussing the Binary Search Tree Data Structure. We’ll be implementing the functions to search, insert and remove values from a Binary Search Tree. We’ll implement these operations recursively as well as iteratively. Binary Search Tree A Binary Search tree has the following property: All nodes should be such that the […]

## Level Order Traversal or Breadth First Traversal of a Tree

In this tutorial, we’ll be discussing what’s Level Order Traversal. Also, we’ll be printing each level of the tree. We’ll use the two major approaches – Recursive and Iterative and see what’s the difference in time complexities between them. Level Order Traversal Level Order traversal is also known as Breadth-First Traversal since it traverses all […]

## Linked List Loop Detection – Floyd’s Cycle-Finding Algorithm

In this tutorial, we’ll be discussing a very popular algorithm which is used to detect whether a LinkedList has loops. It’s called Floyd’s Cycle-Finding Algorithm. LinkedList Loop Detection A loop exists in a LinkedList when no NULL is reached as we traverse throughout the LinkedList. So in order to detect whether a LinkedList has a […]

## Height of a Tree Data Structure

In this tutorial, we’ll be discussing Binary Trees. We’ll see how to calculate the height of a tree data structure recursively as well as iteratively. Binary Trees Binary Trees are a data structure in which data is stored in a hierarchical manner rather than linear (as it is done in LinkedList and Arrays). A Binary […]

## Reverse a Linked List

Reversing a Linked List is an interesting problem in data structure and algorithms. In this tutorial, we’ll be discussing the various algorithms to reverse a Linked List and then implement them using Java. Reverse a Linked List LinkedList is a data structure which stores the data in a linear way. Though not in a contiguous […]