PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Microsoft

Print Org Chart by Level

Last updated: Mar 29, 2026

Quick Overview

This question evaluates the ability to model hierarchical data, work with tree/graph data structures, select traversal strategies, and analyze time and space complexity when converting flat employee records into a hierarchical org chart.

  • medium
  • Microsoft
  • Coding & Algorithms
  • Data Scientist

Print Org Chart by Level

Company: Microsoft

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given an organizational chart as a list of employee records: `(employee_id, manager_id, employee_name)`, where `manager_id` is `null` for the CEO. Assume the organization forms a valid tree with exactly one root and no cycles. Build the org chart as a tree, then output the employees level by level from top to bottom, showing all employees in the same layer before moving to the next layer. Explain the data structures you would use, describe the traversal strategy, and analyze the time and space complexity.

Quick Answer: This question evaluates the ability to model hierarchical data, work with tree/graph data structures, select traversal strategies, and analyze time and space complexity when converting flat employee records into a hierarchical org chart.

Related Interview Questions

  • Sort Three Categories In Place - Microsoft (medium)
  • Implement K-Means and Detect Divisible Subarrays - Microsoft (medium)
  • Implement SFT Sample Packing - Microsoft (medium)
  • Implement SQL Table and DNA Ordering - Microsoft (medium)
  • Solve power jumps and graph tour - Microsoft (hard)
Microsoft logo
Microsoft
Jan 16, 2026, 12:00 AM
Data Scientist
Technical Screen
Coding & Algorithms
1
0
Loading...

You are given an organizational chart as a list of employee records: (employee_id, manager_id, employee_name), where manager_id is null for the CEO. Assume the organization forms a valid tree with exactly one root and no cycles.

Build the org chart as a tree, then output the employees level by level from top to bottom, showing all employees in the same layer before moving to the next layer.

Explain the data structures you would use, describe the traversal strategy, and analyze the time and space complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Microsoft•More Data Scientist•Microsoft Data Scientist•Microsoft Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.