Write a recursive function that prints all the nodes less than a given value \(v\) in a binary tree of integers.


Difficulty level
This exercise is mostly suitable for students
void print_less_v(Btree B, int v)
{
	if (B)
	{
		if (B->data < v)
			printf("%d ", B->data);
		print_less_v(B->left, v);
		print_less_v(B->right, v);
	}
}

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Complexity of sum of square root