concepts4you

HBase Tutorial : Part 1

Certain points to define HBase : Column oriented database management system, which runs on top of HDFS Not a relational data store and does not support query language like SQL – this is called NoSQL database Supports a very flexible data model and thus, it is really good for data that cannot be saved in […]

Find commong GCD for two numbers using recursion.

This is a simple program. Pasting it below. public class FindGCD {     public static void main (String s[]) {         System.out.println(gcd(48, 24));     }     public static int gcd (int x, int y) {         if (x > y) {             return findGcd (x, y);         } else {             return findGcd (y,x);         }     }     private static int findGcd (int l, int […]

Non-recursive algorithm to find the pre-order successor of a given node in a BST

Question: Write a non-recursive algorithm to find the pre-order successor of a given node in a BST. Solution: Let me tell you the background first. There are basically three kind of traversal for a binary tree. Each traversal is named on the basis of processing of root node. For example in preorder traversal, root will […]

Configure passwordless ssh to localhost

How to configure passwordless ssh to localhost? Read on for steps.

Concept of Java : Difference between ‘==’ and equals

In Java, we compare two values using either ‘==’ or equals. Let’s see the difference between these two in this article. Before explaining the difference, I would like to explain what happens when we assign one value to another – for example, whey you say i = j where i might be a variable of […]

Convert a binary search tree to sorted list

Ques: You have given a binary search tree and you need to change this tree to link list that contains nodes in sorted order. Solution: We all know that smaller values are on left side. So we need to keep left side values at first place for sorted list. To make this happen we will […]

Sub-array with sum zero

Ques: An array contains negative as well as positive numbers in random order, find the first sub array for which the sum of all the elements is zero. Solution: First of all we need to think how can we find out if the sum of all the elements in a sub array is zero. Let’s […]