fix some bug and add cap method to array

This commit is contained in:
2019-04-15 01:42:22 +08:00
parent 703dff0813
commit 293e02149f
4 changed files with 41 additions and 3 deletions

View File

@@ -2,15 +2,18 @@ package heap
import (
"474420502.top/eson/structure/compare"
"474420502.top/eson/structure/sparse_array/array3"
)
type Heap struct {
size int
cap int
elements []interface{}
elements *array3.Array3
Compare compare.Compare
}
func New(Compare compare.Compare) *Heap {
return &Heap{Compare: Compare, cap: 8}
h := &Heap{Compare: Compare, cap: 8}
h.elements = array3.NewWithCap(4, 4, 4)
return h
}