title: Why does Dijkstra's Algorithm use a heap (priority queue)?
body: <p>I have tried using Djikstra's Algorithm on a cyclic weighted graph without using a priority queue (heap) and it worked.</p>
  
  <p>Wikipedia states that the original implementation of this algorithm does not use a priority queue and runs in O(V<sup>2</sup>) time.</p>
  
  <p>Now if we just removed the priority queue and used normal queue, the run time is linear, i.e. O(V+E). </p>
  
  <p>Can someone explain why we need the priority queue?</p>