private int setSize(Node root){
        if(root == null){
            return 0;
        }
        return 1 + Math.max((root.left != null ? root.left.size : 0), (root.right != null ? root.right.size : 0));
    }
http://www.geeksforgeeks.org/count-smaller-elements-on-right-side/
Test cases
All same elements
Many duplicates
Negative numbers
0s
Sorted or reverse sorted
src/com/interview/tree/CountNumberOfSmallerElementOnRight.java