Question
3. Sloppy Inc. has a very unusual way to communicate the decisions made by its CEO to all employees. Each day, any employee that knows
3. Sloppy Inc. has a very unusual way to communicate the decisions made by its CEO to all employees. Each day, any employee that knows the decision can disclose it to at most one of its direct subordinates. Design an efficient algorithm to compute the minimum number of days required for the decision to be disclosed to all employees. What is the time complexity of your algorithm?
To help you design your algorithm, assume that Sloppy Inc. has a hierarchical structure resembling an n-ary tree. Each employee is labeled {0, 1, . . . , n 1}, where 0 corresponds to root of the tree (the CEO). To store the tree you can use a two-dimensional array C [n] [n], where k = C [i] [0] is the number of direct subordinates of employee i, and C [i] [1 . . . k] contains the labels of each direct subordinate employee. Any other entry in the array has value of 1. Note that the order in which the messages are distributed matters, e.g., employees with deeper subordinate trees should probably receive the message first. Hint: Solving this problem requires a recursion.
Please use pseudo-code and present algorithms clearly
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started