Non-heap impentation of dijkstra's algorithm