Data Structures

This category contains all the posts related to data structures. For e.g.: Hash Tables, Linked Lists, Trees, Graphs, Heaps, Tries etc..

Graph Theory

Preface This is the first article in the Graph Theory - Online Classes. To all my readers and friends, you can safely skip the first two paragraphs. The motivation to write this series Its been long I have been planning to write this article and now I think is the right time to start a new category & series of articles in the Graph Theory. As a student it was always the most complicated topic for me and I was scared with the topic. I am sure many of you must have faced the same. Of course everyone has their own reason, for me it was the order in which it was taught and definitely it w...
Read More

Tree Diameter

Introduction This is the fifth article in the Tree Traversals - Online Classes. A very interesting problem is to find the diameter of a tree. The challenge is not in coding the algorithm but in understanding the meaning of the problem. We will try to define the problem so that visualizing the solution becomes easy. Defining the problem - Tree Diameter Few confusions about the diameter must be avoided before we start. The tree diameter is always the distance between two leaf nodes The diameter may or may not pass through the root. The diameter can also lie on one of the two sides,...
Read More

Spiral Traversal

Spiral Traversal or Zigzag Traversal in a Tree. This is the fourth article in the Tree Traversals - Online Classes. Recently I wrote an article on Level Order Tree Traversal. Another problem on the same lines is to traverse the tree in a zigzag manner. That is also termed as spiral traversal. This question has been asked in many companies during the interview process. Although it is not very specific problem, if you understand the idea behind traversing a tree in breadth first manner, then you can easily solve this. Please read further for more understanding. Defining the problem L...
Read More

Level Order Tree Traversal

Introduction This is the third article in the Tree Traversals - Online Classes. I have written many articles about non-linear data structures and their traversals. But the more you dive in you can find many more ways to traverse a tree. Here we try to solve the level order tree traversal for a binary tree and we will also try to figure out other variations of this traversal. This can we precisely extended for a n-ary tree as well. Defining the problem Let us consider the above tree, if we follow the blue line from root till end and print all the nodes, we will end up printing the lev...
Read More

Understanding Search Trees – Red Black Trees

Introduction This article is to highlight the importance of having a Search tree with minimum height and revisit couple of data structures which can guarantee a minimum height Tree. Understanding Search Trees - Red Black Trees An evolution of BST that aim to keep the tree balanced without affecting the complexity of the primitive operations. This is done by colouring each node in the tree with either red or black and preserving a set of properties that guarantees that the deepest path in the tree is not longer than twice the shortest one. A red black tree is a binary search tree with the...
Read More

Asymptotic Analysis

[nextpage title="Introduction"] This article Data Structures and Algorithms – Asymptotic Analysis presents a better approach to understand how to analyze algorithms. Moreover, we would like to understand what algorithms are and why they are important. In this article we will just try and understand the idea behind analyzing algorithms. On the other hand if you are interested in watching a video for this article, you can subscribe our Youtube Channel. Question: What are algorithms and their analysis? Answer: It’s a theoretical study of computer program’s performance and resource usa...
Read More

Data Structures and Algorithms – Introduction

Introduction This series of articles is from the online sessions I conduct for working professionals as a part of the data structures and algorithm subject. I will keep posting each session's article here so that it can be used by everyone who is not able to attend the sessions. On the other hand if you are interested in watching a video for this article, you can subscribe our Youtube Channel. What are data structures? Data is the basis of information, in today’s e-age information is the most important asset. An important and un-deniable fact about data is that its volume is exponent...
Read More