Using a dictionary as a priority queue [1]