Answer:
The algorithm to this question as follows:
Algorithm:
finding_small_element(element,Key xa) //defining method that accepts parameter
{
if (element.value>= xa) //check value
{
//skiping node
return;
}
print(element.value);//print value
if (element.left != NULL) //check left node value
{
finding_small_element(element.left,xa); //using method
}
if (element.right != NULL) //check right node value
{
finding_small_element(element.right,xa); //using method
}
}
Explanation:
In the above pre-order traversing algorithm a method "finding_small_element" is defined, that accepts two parameter, that is "element and ax', in which "element" is node value and ax is its "key".