Post order Successor in a threaded binary tree

406 Views Asked by At

I have snippets of my code that should return the address of both the inorder and preorder successor of node alpha in a Double Threaded Binary Tree

I am stuck with how to make a procedure for the postorder successor of node alpha. Some advice would be greatly appreciated

BinaryTreeNode *INSUC(BinaryTreeNode *alpha)
{
      BinaryTreeNode *beta = alpha->RSON;
      if (alpha->RTAG == 1){
       while(beta->LTAG==1)
           beta = beta->LSON;
      }
      return beta;
}


BinaryTreeNode *PRESUC (BinaryTreeNode *alpha)
{
    if(alpha->LTAG == 1){
        return alpha->LSON;
    }
    else{
        while(alpha->RTAG == 0){
            alpha = alpha->RSON;
        }
        return alpha->RSON;
    }
}
0

There are 0 best solutions below