#include<stdio.h>
#include<stdlib.h>
struct
Node
{
int
data;
struct
Node *left, *right;
};
struct
Node *newNode(
int
item)
{
struct
Node *temp = (
struct
Node *)
malloc
(
sizeof
(
struct
Node));
temp->data = item;
temp->left = temp->right = NULL;
return
temp;
}
int
print4Subtree(
struct
Node *root)
{
if
(root == NULL)
return
0;
int
l = print4Subtree(root->left);
int
r = print4Subtree(root->right);
if
((l + r + 1) == 4)
printf
(
"%d "
, root->data);
return
(l + r + 1);
}
int
main()
{
struct
Node *root = newNode(1);
root->left = newNode(2);
root->right = newNode(3);
root->left->left = newNode(4);
root->left->right = newNode(5);
root->right->left = newNode(6);
root->right->right = newNode(7);
root->right->left->right = newNode(8);
print4Subtree(root);
return
0;
}