private Node newNode(K k, Node root) {
        if (root == null) return new Node(k, null);

        if (k.compareTo(root.value) < 0)
            root.left = newNode(k, root.left);
        else if (k.compareTo(root.value) > 0)
            root.right = newNode(k, root.right);
        else
            root.duplicateCount++;

        return root;
    }
This is another version of binary search tree with support of duplicates.
Idea: store extra variable that counts the number of duplicates in each node.
src/ds/BSTWithDuplicate.java