Documentation
¶
Index ¶
- func LinkParent(root *Node)
- func MergeChildren(src, dst *Node)
- func MergeChildren2(src, dst *Node)
- func PostorderTraversal(root *Node, handle func(current *Node) bool) bool
- func PreorderFullPath(root *Node) [][]*Node
- func PreorderTraversal(root *Node, handle func(current *Node) bool) bool
- func SortBrother(root *Node, descOrder bool)
- type ListNode
- type Node
- func BuildTreeFromList(listNodes []*ListNode) *Node
- func DeleteNode(tree, node *Node) *Node
- func FindLCA(root *Node, nodeValue1, nodeValue2 NodeValue) *Node
- func GenLCASubTree(root *Node, nodeValues []NodeValue) *Node
- func GenSubUnaryTreeByLCA(start, current, lca *Node) *Node
- func GenTwoNodesLCASubTree(root *Node, nodeValue1, nodeValue2 NodeValue) *Node
- func MergeIntersectSubTrees(tree1, tree2 *Node) *Node
- func PostorderFind(root *Node, targetValue NodeValue) *Node
- func PreorderFind(root *Node, targetValue NodeValue) *Node
- type NodeValue
- type NodeValueCommI
- type NodeValueCommS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PostorderTraversal ¶
PostorderTraversal 后序遍历函数
func PreorderTraversal ¶
PreorderTraversal 前序遍历函数
Types ¶
type Node ¶
func BuildTreeFromList ¶
BuildTreeFromList 从节点列表生成节点树
func GenLCASubTree ¶
GenLCASubTree 生成树上任意多个节点的最小连通子树
func GenSubUnaryTreeByLCA ¶
GenSubUnaryTreeByLCA 生成从start节点到lca的单叉树
func GenTwoNodesLCASubTree ¶
GenTwoNodesLCASubTree 生成树上两个节点的最小连通子树
func MergeIntersectSubTrees ¶
MergeIntersectSubTrees 合并两个相交的子树
func PostorderFind ¶
PostorderFind 后序搜索函数: 从root中找到target
func PreorderFind ¶
PreorderFind 前序搜索函数: 从root中找到target
type NodeValueCommI ¶
type NodeValueCommI struct {
V int
}
func (*NodeValueCommI) Compare ¶
func (cv *NodeValueCommI) Compare(other NodeValue) int
func (*NodeValueCommI) GetKey ¶
func (cv *NodeValueCommI) GetKey() interface{}
func (*NodeValueCommI) GetKeyCode ¶
func (cv *NodeValueCommI) GetKeyCode() []byte
func (*NodeValueCommI) IsEqual ¶
func (cv *NodeValueCommI) IsEqual(other NodeValue) bool
type NodeValueCommS ¶
type NodeValueCommS struct {
V string
}
func (*NodeValueCommS) Compare ¶
func (cv *NodeValueCommS) Compare(other NodeValue) int
func (*NodeValueCommS) GetKey ¶
func (cv *NodeValueCommS) GetKey() interface{}
func (*NodeValueCommS) GetKeyCode ¶
func (cv *NodeValueCommS) GetKeyCode() []byte
func (*NodeValueCommS) IsEqual ¶
func (cv *NodeValueCommS) IsEqual(other NodeValue) bool
Click to show internal directories.
Click to hide internal directories.