MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / PreOrder

Method PreOrder

structure/tree/bstree.go:87–91  ·  view source on GitHub ↗

PreOrder Traverses the tree in the following order Root --> Left --> Right

()

Source from the content-addressed store, hash-verified

85
86// PreOrder Traverses the tree in the following order Root --> Left --> Right
87func (t *BinarySearch[T]) PreOrder() []T {
88 traversal := make([]T, 0)
89 preOrderRecursive[T](t.Root, t._NIL, &traversal)
90 return traversal
91}
92
93// InOrder Traverses the tree in the following order Left --> Root --> Right
94func (t *BinarySearch[T]) InOrder() []T {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected