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

Method PreOrder

structure/tree/rbtree.go:96–100  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

94
95// PreOrder Traverses the tree in the following order Root --> Left --> Right
96func (t *RB[T]) PreOrder() []T {
97 traversal := make([]T, 0)
98 preOrderRecursive[T](t.Root, t._NIL, &traversal)
99 return traversal
100}
101
102// InOrder Traverses the tree in the following order Left --> Root --> Right
103func (t *RB[T]) InOrder() []T {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected