Computer Science, asked by gulnazkousar97, 30 days ago

Problem Statement
1
[ C
2
Tania is a very joyful child. Sonia gifted her a Tree on
her birthday. Tree has n nodes numbered from 1 to n
(rooted at node 1). Each node can have color either
red or black. Initially, all the nodes are red.
1 #inclu
2 #inclu
#includ
4
#incluc
As soon as Tania gets the tree, she starts playing with
it. She performs q operations on the tree. Each
operation is described by 2 integers, an ID (either 1, 2
or 3) and a node P.
Nm in 6000
6 v int mai
/*
10
ret
Description of the operations are as follows:
11
Light
• ID1: Tania paints red on all the nodes in the
subtree of P (excluding the node P).
• ID2: Tania paints black on all the nodes in the
subtree of P (excluding the node P).
• ID3: Tania counts the number of red nodes in the
subtree of P (excluding the node P).
Rules
Help her performing operations and print the count​

Answers

Answered by priya63675
0

Answer:

Hi, your are write question

Similar questions