private void DFS(char str[][],int pos,int distance,Map<Character,Boolean> visited){
        for(int i=0; i < distance; i++){
            System.out.print(" ");
        }
        System.out.println(str[pos][1]);
        char ch = str[pos][1];
        visited.put(ch, true);
        int i = pos+1;
        for(; i < str.length; i++){
            if(ch == str[i][0]){
                if(i != str.length){
                    DFS(str,i,distance + 5,visited);
                }
            }
        }
    }
http://www.geeksforgeeks.org/custom-tree-problem/
src/com/interview/recursion/PrintArrayInCustomizedFormat.java