diff --git a/tree/BinarySearchTree/binaryserachtree.go b/tree/BinarySearchTree/binaryserachtree.go index 7b3ee9c..543bfa1 100644 --- a/tree/BinarySearchTree/binaryserachtree.go +++ b/tree/BinarySearchTree/binaryserachtree.go @@ -72,7 +72,7 @@ func (tree *BinarySearchTree[T]) Find(item T) (*BinarySearchTreeNode[T], error) // // Apply should not change the item in a Node, as this could affect the binary tree structure. // -// This method is a wrapper for PreorderTraversalFold(tree.root, initialAccumulator, f) +// This method is a wrapper for ApplyNodePreorder(tree.root, f) func ApplyTreePreorder[T any](tree *BinarySearchTree[T], f func(item T)) { if tree.root == nil { return @@ -84,7 +84,7 @@ func ApplyTreePreorder[T any](tree *BinarySearchTree[T], f func(item T)) { // // Apply should not change the item in a Node, as this could affect the binary tree structure. // -// This method is a wrapper for InorderTraversalFold(tree.root, initialAccumulator, f) +// This method is a wrapper for ApplyNodeInorder(tree.root, f) func ApplyTreeInorder[T any](tree *BinarySearchTree[T], f func(item T)) { if tree.root == nil { return @@ -96,7 +96,7 @@ func ApplyTreeInorder[T any](tree *BinarySearchTree[T], f func(item T)) { // // Apply should not change the item in a Node, as this could affect the binary tree structure. // -// This method is a wrapper for PostorderTraversalFold(tree.root, initialAccumulator, f) +// This method is a wrapper for ApplyNodePostorder(tree.root, f) func ApplyTreePostorder[T any](tree *BinarySearchTree[T], f func(item T)) { if tree.root == nil { return @@ -109,7 +109,7 @@ func ApplyTreePostorder[T any](tree *BinarySearchTree[T], f func(item T)) { // Fold a function f over the tree preorder. // -// This method is a wrapper for FoldPreorder(tree.root, initialAccumulator, f) +// This method is a wrapper for FoldNodePreorder(tree.root, initialAccumulator, f) func FoldTreePreorder[T, G any](tree *BinarySearchTree[T], initialAccumulator G, f func(item T, accumulator G) G) G { if tree.root == nil { return initialAccumulator @@ -119,7 +119,7 @@ func FoldTreePreorder[T, G any](tree *BinarySearchTree[T], initialAccumulator G, // Fold a function f over the tree Inorder. // -// This method is a wrapper for FoldInorder(tree.root, initialAccumulator, f) +// This method is a wrapper for FoldNodeInorder(tree.root, initialAccumulator, f) func FoldTreeInorder[T, G any](tree *BinarySearchTree[T], initialAccumulator G, f func(item T, accumulator G) G) G { if tree.root == nil { return initialAccumulator @@ -129,7 +129,7 @@ func FoldTreeInorder[T, G any](tree *BinarySearchTree[T], initialAccumulator G, // Fold a function f over the tree Postorder. // -// This method is a wrapper for FoldPostorder(tree.root, initialAccumulator, f) +// This method is a wrapper for FoldNodePostorder(tree.root, initialAccumulator, f) func FoldTreePostorder[T, G any](tree *BinarySearchTree[T], initialAccumulator G, f func(item T, accumulator G) G) G { if tree.root == nil { return initialAccumulator diff --git a/tree/RedBlackTree/redblacktree.go b/tree/RedBlackTree/redblacktree.go index bc5ecc6..ccfffcc 100644 --- a/tree/RedBlackTree/redblacktree.go +++ b/tree/RedBlackTree/redblacktree.go @@ -205,7 +205,7 @@ func (tree *RedBlackTree[T]) Find(item T) (*RedBlackTreeNode[T], error) { // // Apply should not change the item in a Node, as this could affect the tree structure. // -// This method is a wrapper for PreorderTraversalFold(tree.root, initialAccumulator, f) +// This method is a wrapper for ApplyNodePreorder(tree.root, f) func ApplyTreePreorder[T any](tree *RedBlackTree[T], f func(item T)) { if tree.root == nil { return @@ -217,7 +217,7 @@ func ApplyTreePreorder[T any](tree *RedBlackTree[T], f func(item T)) { // // Apply should not change the item in a Node, as this could affect the tree structure. // -// This method is a wrapper for InorderTraversalFold(tree.root, initialAccumulator, f) +// This method is a wrapper for ApplyNodeInorder(tree.root, f) func ApplyTreeInorder[T any](tree *RedBlackTree[T], f func(item T)) { if tree.root == nil { return @@ -228,7 +228,8 @@ func ApplyTreeInorder[T any](tree *RedBlackTree[T], f func(item T)) { // Apply a function f to each node in a tree Postorder. // // Apply should not change the item in a Node, as this could affect the tree structure. -// This method is a wrapper for PostorderTraversalFold(tree.root, initialAccumulator, f) +// +// This method is a wrapper for ApplyNodePostorder(tree.root, f) func ApplyTreePostorder[T any](tree *RedBlackTree[T], f func(item T)) { if tree.root == nil { return @@ -241,7 +242,7 @@ func ApplyTreePostorder[T any](tree *RedBlackTree[T], f func(item T)) { // Fold a function f over the tree preorder. // -// This method is a wrapper for FoldPreorder(tree.root, initialAccumulator, f) +// This method is a wrapper for FoldNodePreorder(tree.root, initialAccumulator, f) func FoldTreePreorder[T, G any](tree *RedBlackTree[T], initialAccumulator G, f func(item T, accumulator G) G) G { if tree.root == nil { return initialAccumulator @@ -251,7 +252,7 @@ func FoldTreePreorder[T, G any](tree *RedBlackTree[T], initialAccumulator G, f f // Fold a function f over the tree Inorder. // -// This method is a wrapper for FoldInorder(tree.root, initialAccumulator, f) +// This method is a wrapper for FoldNodeInorder(tree.root, initialAccumulator, f) func FoldTreeInorder[T, G any](tree *RedBlackTree[T], initialAccumulator G, f func(item T, accumulator G) G) G { if tree.root == nil { return initialAccumulator @@ -261,7 +262,7 @@ func FoldTreeInorder[T, G any](tree *RedBlackTree[T], initialAccumulator G, f fu // Fold a function f over the tree Postorder. // -// This method is a wrapper for FoldPostorder(tree.root, initialAccumulator, f) +// This method is a wrapper for FoldNodePostorder(tree.root, initialAccumulator, f) func FoldTreePostorder[T, G any](tree *RedBlackTree[T], initialAccumulator G, f func(item T, accumulator G) G) G { if tree.root == nil { return initialAccumulator