Datastructure to represent hierarchial structure
I recently had an interview question that asked how to represent an organizational structure with data structures. Queries like list all employees under a manager should be efficiently queried.

I was answering on the lines of a N-way tree, though I was not very sure what should be the key and how to implement it. Curious to know what is the best way this can be done.
Datastructure to represent hierarchial structure
===

I recently had an interview question that asked how to represent an organizational structure with data structures. Queries like list all employees under a manager should be efficiently queried.

I was answering on the lines of a N-way tree, though I was not very sure what should be the key and how to implement it. Curious to know what is the best way this can be done.