Introduction
This is the second article in the Graph Theory - Online Classes.
Dear readers, I assume that you have already finished reading the first post, if not I would advise you to please go through the first article in the series Introduction to Graph Theory, as this post will require some basic knowledge which we discussed in the previous post.
Few Special Graphs
The Null Graph
The first graph we will discuss is the Null Graph. By definition, this graph has a V(G) which is non-empty and a E(G) which is empty. In simple words a graph which only has vertices and no edges is a Null...

Read More
# onlineclasses

## 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
## Code Comment

Introduction
Code Comment is the second pillar to a readable and maintainable code (first being good naming conventions). Mostly people do not pay much attention to comments when they start coding and later it grows big enough to force them to not pay attention and fix it. They may end up investing more time in putting up the right comments at right places.
There may be reasons to not use comments but believe me there are always more reasons to comment your code properly. Any time is a right time to add comments and adding comment is must be a continuous process. Even if you add a line of ...

Read More