Data Structures

Data structure  is an efficient way of organizing data for storage and access by an algorithm where as an algorithm a step by step procedure for performing some task in a finite amount of time. Algorithms and data structures are closely linked to each other.

Continue reading


Queue ADT Implementation

The Queue ADT stores arbitrary objects and insertions and deletions of this ADT follow the first-in-first-out (FIFO) scheme i.e. insertions are at the rear of the queue and removals are from the front of the queue. As in a line or queue at a ticket stand, items are removed from the data structure in the same order that they are added.

Continue reading


Recursive Algorithm: Towers of Hanoi

The classic problem of the Towers of Hanoi is a mathematical game or puzzle, where you have 3 towers and N disks of different sizes which can slide onto any tower. The puzzle starts with disks sorted in ascending order of size from top to bottom, the smallest at the top, thus making a conical shape. 

Continue reading


Java HashMap Implementation in a nutshell

A hash map (or hash table) is a data structure that maps keys to values for highly efficient lookup. There are a number of ways of implementing this data structure. This post is about the simple implementation of hashmap in Java using an array of a linked list.

Continue reading


Custom HashSet Implementation in Java

A hash set is a data structure offers constant time performance for the basic operations (addremovecontains and size), assuming the hash function disperses the elements properly among the buckets. There are a number of ways of implementing this data structure. This post is about the simple implementation of hashmap in Java using an array of a linked list.

Continue reading