复制二叉树
复制二叉树需要复制所有结点的值
递归实现
void copy(BiTree source, BiTree copy) { if (source == NULL) { copy = NULL; return; } else { copy = (BiTree)malloc(sizeof(BiTreeNode)); copy->data = source->data; copy(source->lchild, copy->lchild); copy(source->rchild, copy->rchild); } }
|