谁能解释 BinaryHeap 构造函数?(见下面的java代码)我不明白以下几行:
- 数组 = (AnyType[]) new Comparable[ ( currentSize + 2 ) * 11 / 10 ];
for( AnyType item : items) array[ i++ ] = item;
public BinaryHeap( AnyType [ ] items ) { currentSize = items.length; array = (AnyType[]) new Comparable[ ( currentSize + 2 ) * 11 / 10 ]; int i = 1; for( AnyType item : items ) array[ i++ ] = item; buildHeap( ); }
...
}