004

    xiaoxiao2021-03-25  73

    二叉树的前序遍历

    void preorder(int x) { if(x==0) return; cout<<x; preorder(a[x].ld); preorder(a[x].rd); } 二叉树的中序遍历

    void inorder(int x) { if(x==0) return; preorder(a[x].ld); cout<<x; preorder(a[x].rd); } 二叉树的后续遍历

    void reorder(int x) { if(x==0) return; preorder(a[x].ld); preorder(a[x].rd); cout<<x; }

    转载请注明原文地址: https://ju.6miu.com/read-37670.html

    最新回复(0)