class SparseVector extends Vector {

    @Override
    public void set(int i, double val) {
        int pos = Arrays.binarySearch(indices, i);
        if (pos >= 0) {
            this.values[pos] = val;
        } else {
            pos = -(pos + 1);
            insert(pos, i, val);
        }
    }

    public  SparseVector();
    public  SparseVector(int n);
    public  SparseVector(int n, int[] indices, double[] values);
    public  SparseVector(int n, Map<Integer, Double> kv);

}