Documentation ¶
Overview ¶
https://en.wikipedia.org/wiki/Breadth-first_search
https://en.wikipedia.org/wiki/Depth-first_search
https://en.wikipedia.org/wiki/Tree_traversal#In-order_(LNR)
https://en.wikipedia.org/wiki/Tree_traversal#Out-order_(RNL)
https://en.wikipedia.org/wiki/Tree_traversal#Post-order_(LRN)
https://en.wikipedia.org/wiki/Tree_traversal#Post-order_(LRN)
Index ¶
- func BreadthFirstSearchOrder(node any, handler Handler)
- func DepthFirstSearchOrder(node any, handler Handler)
- func Inorder(node any, handler Handler)
- func Outorder(node any, handler Handler)
- func Postorder(node any, handler Handler)
- func Preorder(node any, handler Handler)
- type Handler
- type HandlerFunc
- type LeftNodes
- type MiddleNodes
- type Node
- type Order
- type RightNodes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BreadthFirstSearchOrder ¶
TODO template in Go2.0 is expected BreadthFirstSearchOrder traversals from node ele by Breadth-first search (BFS) ele is a node which may have some interfaces implemented: LeftNodes|MiddleNodes|RightNodes
func DepthFirstSearchOrder ¶
TODO template in Go2.0 is expected DepthFirstSearchOrder traversals from node ele by Depth-first search (DFS) ele is a node which may have some interfaces implemented: LeftNodes|MiddleNodes|RightNodes
func Inorder ¶
TODO template in Go2.0 is expected Inorder traversals from node ele by In-order (LNR) ele is a node which may have some interfaces implemented: LeftNodes|MiddleNodes|RightNodes
func Outorder ¶
TODO template in Go2.0 is expected Outorder traversals from node ele by Out-order (RNL) ele is a node which may have some interfaces implemented: LeftNodes|MiddleNodes|RightNodes
Types ¶
type HandlerFunc ¶
The HandlerFunc type is an adapter to allow the use of ordinary functions as traversal handlers. If f is a function with the appropriate signature, HandlerFunc(f) is a Handler that calls f.
type LeftNodes ¶
type LeftNodes interface { // Left returns the left node list or nil. LeftNodes() []any }
type MiddleNodes ¶
type MiddleNodes interface { // Middle returns the middle node list or nil. MiddleNodes() []any }
type RightNodes ¶
type RightNodes interface { // Right returns the middle node list or nil. RightNodes() []any }