You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Left returns the left-most (min) node or nil if tree is empty.
func (tree*Tree[K, V]) Left() *Node[K, V] {
varparent*Node[K, V]
current:=tree.Root
forcurrent!=nil {
parent=current
current=current.Left
}
returnparent
}
// Right returns the right-most (max) node or nil if tree is empty.
func (tree*Tree[K, V]) Right() *Node[K, V] {
varparent*Node[K, V]
current:=tree.Root
forcurrent!=nil {
parent=current
current=current.Right
}
returnparent
}
Can we expose those methods in the TreeSet too? The workaround of calling arr := treeset.Values() and then grabbing arr[0] and arr[len(arr)-1] seems very wasteful.
The text was updated successfully, but these errors were encountered:
I see that TreeSet is
and
rbt.Tree
hasLeft()
andRight()
to get the min and max:gods/trees/redblacktree/redblacktree.go
Lines 196 to 216 in 14f7142
Can we expose those methods in the TreeSet too? The workaround of calling
arr := treeset.Values()
and then grabbingarr[0]
andarr[len(arr)-1]
seems very wasteful.The text was updated successfully, but these errors were encountered: