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 interface{}, handler Handler)
- func DepthFirstSearchOrder(node interface{}, handler Handler)
- func Inorder(node interface{}, handler Handler)
- func Outorder(node interface{}, handler Handler)
- func Postorder(node interface{}, handler Handler)
- func Preorder(node interface{}, 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 ¶
func BreadthFirstSearchOrder(node interface{}, handler Handler)
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 ¶
func DepthFirstSearchOrder(node interface{}, handler Handler)
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 ¶
func Inorder(node interface{}, handler Handler)
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 ¶
func Outorder(node interface{}, handler Handler)
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.
func (HandlerFunc) Handle ¶
func (f HandlerFunc) Handle(node interface{}, depth int) (goon bool)
ServeHTTP calls f(w, r).
type LeftNodes ¶
type LeftNodes interface {
// Left returns the left node list or nil.
LeftNodes() []interface{}
}
type MiddleNodes ¶
type MiddleNodes interface {
// Middle returns the middle node list or nil.
MiddleNodes() []interface{}
}
type RightNodes ¶
type RightNodes interface {
// Right returns the middle node list or nil.
RightNodes() []interface{}
}