Threaded binary tree is a binary tree in which null pointers are replaced with either inorder predecessor or inorder successors. We have already seen insertion, displaying and deletion in Threaded binary tree.
Now lets see now to find inorder successors of a Node in Threaded Binary Tree
Inorder Successor : Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in Inorder traversal or Inorder Successor of an input node can also be defined as the node with the smallest key greater than the key of the input node.
Node of Threaded binary tree is defined as :
struct Node *left, *right;
C++ Function to find inorder successor of a node
struct Node *inordersuccessor (struct Node *ptr)
if( ptr -> rthread == true )
ptr = ptr -> right;
while(ptr -> lthread == false)
ptr = ptr -> left;