Dijkstra algorithm uses heap instead of stack