Author: dharam

Introduction to B Trees

This post is just an introduction to B Trees and here we will discuss one of the complicated data structures, B Trees. I would advice the reader to get familiar with the Tree data structures, and Balanced Trees. For e.g. : Binary Search Trees, AVL Trees, Red Black Trees and 2-3-4 Trees. If you are not familiar with any/few of the above mentioned data structures, then please do not worry, I will try to explain everything here from scratch and hopefully you might not need any external support. But in case you are trying to learn the above topics, please look into the Additional Read section a...
Read More

Maximum Element Sliding Window

A very interesting problem indeed! Often asked in Interviews in various forms and we will discuss one of these forms here in this post. Problem Statement - Maximum Element Sliding Window Given a stream or array of elements (preferably integers). Find the elements with maximum value in a window of length K where the window slides by one step to the right every time. What is a Sliding Window? Given an array A, a sliding window of length K is a range of fixed size K in the array such that the range slides to the right by one index. Here is a diagram to explain how sliding window will look...
Read More

What are the advantages of Java Programming Language?

The most basic question asked to a beginner in a Java Interview is "What are the advantages of Java Programming Language?". Here is a detailed answer to this question. Java is a relatively high level language. It provides lot of features out of the box, which makes it easy to learn for today’s developers and focus on the real business implementation rather than worrying about the system level infrastructure management. Few of the advantages of Java Programming Language are: Platform Independence : Java is platform independent, which means that if a program is written and compiled in Ja...
Read More

Hamiltonian Circuit – Seating Arrangement Problem

Here is a problem statement "Twenty members of a club meet each evening for dinner at a round table. They plan to sit such that every member has different neighbors every evening. Find out the number of days for which this arrangement can last." Here is another one "There is a list of 20 cities with roads connecting them, a salesman wants to sell his goods by visiting each city exactly once. Is that possible for a given network of cities?" Many a times we have been given problems like above and it is not really easy to solve them if we are not equipped with the Graph Theory. What ...
Read More

Euler Graphs – Origin of Graph Theory

This should have been my first post in the Graph Theory series but nevertheless I got time to discuss this now. Every one must have heard the famous problem of Seven Bridges of Königsberg. If not, then please take some time to read about the problem either on the Wikipedia or right down below: The city of Konigsberb is located on both the banks of the river Pregel(Kaliningrad, Russia - former Prussia).  The city also included two big islands and these islands were connected to each other and the main land by the means of seven bridges. Something like below: The problem is to devise a...
Read More

Details of Class Loading in JVM

Have you ever seen a ClassNotFoundException or a NoClassDefFoundError? Did you ever face a situation where you are trying to cast and assign it to a compatible reference but it throws a ClassCastException ? Or did you face issues where you never understood where to put the jars in your application? Ever did any hot deployment on a running Application Server and wondered how the new changes get reflected without a server restart? Ever got confused with the process of Class Loading in JVM? If you didn't face any of these, then you are extremely lucky or you are yet to start development :)...
Read More

Java Virtual Machine Startup

In the last post we had a brief idea about the memory model of the Java Virtual Machine. We also came across certain terms like the Creation, Linking, Loading and Initialization of classes. In this post we will try to improve our understanding of all these terms. At the Java Virtual Machine Startup The JVM starts up by creating an initial class and loads it using the bootstrap class loader (we will learn about the class loader in another post). Some implementation of the JVM allow us to pass the name of the initial class using the command line. The JVM then links this initial class. L...
Read More