File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,18 @@ type SkipNodeFunc[T any] func(node *Node[T]) bool
4747// false otherwise.
4848type FindFunc [T any ] func (node * Node [T ]) bool
4949
50+ // ComparatorFunc is a function which compares two values of type T.
51+ // The comparator function should return:
52+ //
53+ // - A negative integer when A is less than B
54+ // - A positive integer when A is greater than B
55+ // - Zero when A equals B
56+ //
57+ // The comparator function is used by IsBinarySearchTree method for
58+ // validating whether a given binary tree is a Binary Search Tree
59+ // (BST).
60+ type ComparatorFunc [T any ] func (a , b T ) int
61+
5062// Node represents a node from a binary tree
5163type Node [T any ] struct {
5264 // Value is the value of the node
You can’t perform that action at this time.
0 commit comments