PriorityQueue and dijkstra
added some dynamic programming