Amazon Interview Question

First Interview. What data structure to use, and how to solve the problem?

Interview Answer

Anonymous

Apr 11, 2011

Hash table, with each entry having pointers to the parents. You loop the hash table, and the ones that don't have parents are the jobs that you schedule first, then the ones that had those as parents, and so on.