Heapsort, Heap, Data Structures, Python, Sorting Algorithms.
distance and set it as the new current node. If all nodes have been visited, stop. Repeat steps 4 to 6 until the destination node is visited. The algorithm can be optimized by using a priority queue [minHeap] to select the node with the smallest tentative distance instead of scanning all unexplored