public void printNodes(Node root){
        if(root == null){
            return;
        }
        if(root.left == null || root.right == null){
            if(root.left != null){
                System.out.print(root.left.data + " ");
            }
            if(root.right  != null){
                System.out.print(root.right.data + " ");
            }
        }
        printNodes(root.left);
        printNodes(root.right);
    }
http://www.geeksforgeeks.org/print-nodes-dont-sibling-binary-tree/
This does not print root node even though it has no sibling
Test cases:
Null tree
Only one node tree
All left side tree
All right side tree
Regular mix tree
src/com/interview/tree/NodesWithNoSibling.java