Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tree/BinarySearchTree/binaryserachtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
13 changes: 7 additions & 6 deletions tree/RedBlackTree/redblacktree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading