I need a way to implement a fast lookup algorithm / system to find users very quickly in a multi-level department and multi-level employee/manager relation organization structure.

Departments can have any level of departments and users directly connected to departments. User are connected to departments and other users at the same time.

What would be the best approach to implement such a system? There will be approximately 2000 users and 30 departments. Is there a good way to hold all of this information on memory?


3 Answers 3


I'm more than sure that on this scale (2000 users) pretty much any data structure that allows sequential access will do just fine (provided everyting's in memory, of course). What's even more, do you really need to invent complex lookup structure where a simple list will suffice?

Make It Work Make It Right Make It Fast


find users very quickly

This sounds like a tree structure.

Something like this:

class Department 
 List<Department> ChildDepartments
 List<User> Users

class User
 List<User> Childusers

This should be fine if you want to list all users of a department.


Dictionaries are in general what provide the fastest access. See this link on SO: https://stackoverflow.com/questions/128636/net-data-structures-arraylist-list-hashtable-dictionary-sortedlist-sortedd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.