This question evaluates understanding of tree and graph data structures, transforming flat employee-manager relations into a hierarchical org chart, level-order traversal, and reasoning about data integrity issues such as cycles, missing managers, or multiple roots.
You are given an organization's reporting structure as a flat list of employee-manager relationships. Exactly one employee is the root (the CEO) and has no manager.
Example input schema:
employee_id: int
employee_name: string
manager_id: int | null
Task:
Example output format:
[[CEO], [VP1, VP2], [Mgr1, Mgr2, Mgr3], ...]
Discuss: