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

Method LevelOrder

structure/tree/avl.go:114–118  ·  view source on GitHub ↗

LevelOrder returns the level order traversal of the tree

()

Source from the content-addressed store, hash-verified

112
113// LevelOrder returns the level order traversal of the tree
114func (avl *AVL[T]) LevelOrder() []T {
115 traversal := make([]T, 0)
116 levelOrderHelper[T](avl.Root, avl._NIL, &traversal)
117 return traversal
118}
119
120// AccessNodesByLayer accesses nodes layer by layer (2-D array), instead of printing the results as 1-D array.
121func (avl *AVL[T]) AccessNodesByLayer() [][]T {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected