online classes

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

Naming Conventions

Introduction This is a new series of articles which dictates the best industry practices being used today while coding. The language of reference would be Java but I am sure the concepts will work across languages. There might be few in the list which you need not worry in case you are programming in more advanced languages. The idea is to discuss one best practice a day and give supporting examples and references. I trust that it can help each and every one of us. Before we embark on this long journey, I would like everyone of us to understand what exactly a "best practice" is and how ...
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

A Generic toString in Java

Alternative to Java's toString() method: A generic toString in java For the impatient readers who know the problem I am trying to solve and need the code can scroll down to the Source code section. If you are still reading then, let us describe the problem in hand. Problem Statement Have you ever faced an issue where you included a POJO(Plain Old Java Object) in your source code and tried to print it's state in the logs or may be on the console. But unlike your expectations you ended up with some ugly object references which gives no good representation of the data you require. This t...
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

Data Structures and Algorithms – Recursion

Introduction The article Data Structures and Algorithms – Recursion is the third in series, of online course for Data Structure Algorithm. This is an effort to introduce and explain the Recursion methodology of algorithm design and programming. We will try to write some recursion based code and analyze the complexity of the algorithms in detail. Recursion It is the concept of defining a method that makes a call to itself and the call is termed as a recursive call. This is a readable and still efficient way of designing algorithms in the scenario where the problem in hand can be redefined by...
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