Company: Imc_7aug
Difficulty: medium
Chain of command Problem Description An organization is made up of n people. The organizational structure can be represented as a tree, with each person representing a node in the tree. All but the root node has a single parent, representing the node's upstream reporting line. A node may have zero or more children, representing those people who report into them. If person 1 is the root of the tree, we can represent this structure in an array parent , where parent[i] represents the parent of node i (1-based indexing). Note that parent[0] = -1 , to indicate no parent. Within this organization, directives may be issued from a person to all people reporting into them, including all descendants in the tree. These directives propagate as follows: A person sends the directive to its direct child nodes in ascending order of their indices. If a node has more than one child, the node waits for propagation to complete fully to each child's subtree before issuing the directive to the next child. E