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 predecessor of a Node in Threaded Binary Tree
Inorder Predecessor : Inorder Predecessor of an input node can be defined as the node with the largest key smaller than the key of the input node.
Node of Threaded binary tree is defined as :
struct Node *left, *right;
C++ Function to find inorder predecessor of a node
struct Node *inorderpedecessor ( struct Node *ptr)
if( ptr -> lthread == true )
return ptr -> left;
ptr = ptr -> left;
while(ptr -> rthread == false)
ptr = ptr -> right;