public static void main(String args[]) {
        Node root = null;
        BinaryTree bt = new BinaryTree();
        root = bt.addNode(10, root);
        root = bt.addNode(-10, root);
        root = bt.addNode(20, root);
        root = bt.addNode(15, root);
        root = bt.addNode(-7, root);
        root = bt.addNode(22, root);
        root = bt.addNode(-4, root);
        root = bt.addNode(12, root);
        System.out.println("Before decoding");
        TreeTraversals tt = new TreeTraversals();
        tt.inOrder(root);
        System.out.println();
        tt.preOrder(root);
        System.out.println();
        SuccinctTree st = new SuccinctTree();
        Result r = st.encode(root);
        root = st.decode(r);
        System.out.println("After decoding");
        tt.inOrder(root);
        System.out.println();
        tt.preOrder(root);
    }
Date 11/01/2015
 @author Tushar

 Encode and decode binary tree using succinct encoding technique

References - http://www.geeksforgeeks.org/succinct-encoding-of-binary-tree/
https://en.wikipedia.org/wiki/Binary_tree#Succinct_encodings
src/com/interview/tree/SuccinctTree.java