bump go modules

Signed-off-by: GitHub <[email protected]>
This commit is contained in:
Florian Wagner
2022-04-26 03:37:19 +00:00
committed by GitHub
parent 062fe61ca3
commit bde5f88201
1116 changed files with 131098 additions and 88443 deletions
+9 -6
View File
@@ -19,9 +19,8 @@ import (
"strings"
)
func assertTreeImplementation() {
var _ trees.Tree = (*Heap)(nil)
}
// Assert Tree implementation
var _ trees.Tree = (*Heap)(nil)
// Heap holds elements in an array-list
type Heap struct {
@@ -98,15 +97,19 @@ func (heap *Heap) Clear() {
// Values returns all elements in the heap.
func (heap *Heap) Values() []interface{} {
return heap.list.Values()
values := make([]interface{}, heap.list.Size(), heap.list.Size())
for it := heap.Iterator(); it.Next(); {
values[it.Index()] = it.Value()
}
return values
}
// String returns a string representation of container
func (heap *Heap) String() string {
str := "BinaryHeap\n"
values := []string{}
for _, value := range heap.list.Values() {
values = append(values, fmt.Sprintf("%v", value))
for it := heap.Iterator(); it.Next(); {
values = append(values, fmt.Sprintf("%v", it.Value()))
}
str += strings.Join(values, ", ")
return str