why new Comparable[(currentMaxIndex + 2) * 11 / 10] while construct a heap from given array?

60 views Asked by At

THe book Data structure and algorithm analysis in Java gives the code of BinaryHeap's constructor

public BinaryHeap(AnyType[] items){
    currentMaxIndex = items.length;
    this.items = (AnyType[]) new Comparable[(currentMaxIndex + 2) * 11 / 10];
    int i = 1;
    for(AnyType item : items){
        this.items[i++] = item;
    }
    buildHead();
}

Why is the space of Comparable[] (currentMaxIndex + 2) * 11 / 10? What's the meaning of doing this?

0

There are 0 answers