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

Function preOrderRecursive

structure/tree/tree.go:85–94  ·  view source on GitHub ↗
(n, nilNode Node[T], traversal *[]T)

Source from the content-addressed store, hash-verified

83}
84
85func preOrderRecursive[T constraints.Ordered](n, nilNode Node[T], traversal *[]T) {
86 if n == nilNode {
87 return
88 }
89
90 *traversal = append(*traversal, n.Key())
91 preOrderRecursive(n.Left(), nilNode, traversal)
92 preOrderRecursive(n.Right(), nilNode, traversal)
93
94}
95
96func postOrderRecursive[T constraints.Ordered](n, nilNode Node[T], traversal *[]T) {
97 if n == nilNode {

Callers

nothing calls this directly

Calls 3

KeyMethod · 0.65
LeftMethod · 0.65
RightMethod · 0.65

Tested by

no test coverage detected