func (tree *Tree) CopyTree() *Tree { if (tree == nil) { return nil } else { copiedTree := &Tree { tree.Left.CopyTree(), tree.Mid.CopyTree(), tree.Right.CopyTree(), tree.Value, nil, tree.Orientation, tree.IsTerminal, tree.Type, } if copiedTree.Left != nil { copiedTree.Left.Parent = copiedTree } if copiedTree.Right != nil { copiedTree.Right.Parent = copiedTree } if copiedTree.Mid != nil { copiedTree.Mid.Parent = copiedTree } return copiedTree }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)