Amazon interview question

heaps, graphs, trees using dynamic programming