static void addElement(List<Node> list, Node node) {
        if ( null == list ) {
            throw new NullPointerException("The collection is null");
        }
        if ( list.isEmpty() ) {
            list.add(node);
        }

        int size = list.size();
        int i = 0;
        int j  = size - 1;

        while ( j-i > 1 ) {
            int mid = (j + i)/2;
            Node midNode = list.get(mid);
            if ( node.compareTo(midNode) < 0 ) {
                j = mid;
            }
            else {
                i = mid;
            }
        }
        if ( node.compareTo(list.get(i)) < 0 ) {
            list.add(i, node);
        }
        else if ( node.compareTo(list.get(j)) > 0 ) {
            list.add(j + 1, node);
        }
        else if ( node.compareTo(list.get(i)) > 0 && node.compareTo(list.get(j)) < 0 )  {
            list.add(j, node);
        }
    }