gods icon indicating copy to clipboard operation
gods copied to clipboard

Request: add methods Min() and Max() to TreeSet

Open miparnisari opened this issue 1 year ago • 1 comments

I see that TreeSet is

type Set struct {
	tree *rbt.Tree
}

and rbt.Tree has Left() and Right() to get the min and max:

https://github.com/emirpasic/gods/blob/14f714261f50e6d3e4af1cd29e4ae11ffdedab94/trees/redblacktree/redblacktree.go#L196-L216

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.

miparnisari avatar Jul 12 '24 18:07 miparnisari

Should be there now.

yossev avatar Jul 20 '24 14:07 yossev