Object-Oriented Programming · Microsoft · Medium
You are given a list of directed pairs (manager_id, employee_id) that defines an organizational hierarchy in the form of a tree. Implement a structure with the following operations: count_reports(person_id) returns the total subtree size for that person, counting both direct and indirect reports. add_edge(manager_id, employee_id) inserts a new manager-report relationship. move(employee_id, new_manager_id) changes the manager of an existing employee to a different manager.…
Checking your access…