Documentation ¶
Overview ¶
Code generated by github.com/goghcrow/go-co DO NOT EDIT.
Index ¶
Constants ¶
View Source
const ( PreOrder WalkMode = 0 InOrder = 1 PostOrder = 2 )
Variables ¶
This section is empty.
Functions ¶
func Match ¶
func Match[V comparable](rootA, rootB *Node[V], mode WalkMode) bool
Match the same iterating path
func Walk ¶
func Walk[V any](n *Node[V], mode WalkMode) (_ Iter[V]) { if n == nil { return } switch mode { case PreOrder: Yield(n.Val) YieldFrom(Walk(n.Left, mode)) YieldFrom(Walk(n.Right, mode)) case InOrder: YieldFrom(Walk(n.Left, mode)) Yield(n.Val) YieldFrom(Walk(n.Right, mode)) case PostOrder: YieldFrom(Walk(n.Left, mode)) YieldFrom(Walk(n.Right, mode)) Yield(n.Val) default: panic("unknown walk mode") } return }
Types ¶
Click to show internal directories.
Click to hide internal directories.