void swap(BitTree b){
if(b){
swap(b->lchild);//遞歸交換結點左孩子的左右子樹。。。
swap(b->rchild);//遞歸交換結點右孩子的左右子樹。。
temp = b->lchild;//交換左右子樹
b->lchild = b->rchild;
b->rchild = temp;
}
}
您可能感興趣的- 非遞歸先序遍歷二叉樹https://www.cnblogs.com/Coeus-P/p/9353186.html
- 非遞歸后序遍歷二叉樹版本二https://www.cnblogs.com/Coeus-P/p/9354754.html
- 遞歸算法--二叉樹寬度https://www.cnblogs.com/Coeus-P/p/9354671.html
- 遞歸算法--交換二叉樹左右子樹https://www.cnblogs.com/Coeus-P/p/9353568.html
- 遞歸算法--二叉樹高度https://www.cnblogs.com/Coeus-P/p/9353528.html
- 遞歸算法--二叉樹中葉子結點https://www.cnblogs.com/Coeus-P/p/9353505.html
- 遞歸算法--二叉樹中度為2的結點https://www.cnblogs.com/Coeus-P/p/9353495.html
- 遞歸算法--二叉樹中度為1的結點https://www.cnblogs.com/Coeus-P/p/9353484.html
- 非遞歸實現斐波那契數列https://www.cnblogs.com/Coeus-P/p/9353452.html
- 非遞歸后序遍歷二叉樹版本一https://www.cnblogs.com/Coeus-P/p/9353360.html
- 層次遍歷二叉樹https://www.cnblogs.com/Coeus-P/p/9353257.html
- 非遞歸中序遍歷二叉樹https://www.cnblogs.com/Coeus-P/p/9353227.html
- 非遞歸先序遍歷二叉樹https://www.cnblogs.com/Coeus-P/p/9353186.html