int func(Node root) {
int x = 0;
int y = 0;
queue Q;
Q.push(root);
while(!Q.empty()) {
Node u = Q.top();
Q.pop();
if(u->left == NULL && u->right == NULL) x++;
if(u->left != NULL) {
y++;
Q.push(u->left);
}
if(u->right != NULL) {
y++;
Q.push(u->right);
}
}
return x+y;
}
Above code segment is executed on the following rooted tree:
What will be the output?