title: Modified version of Prim's algorithm with O(kn + m) time complexity
body: <p>Could you please help me with this problem?</p>
  
  <p>Given an undirected graph <em>G</em>, connected, with weighted edges, such that the weights are integers in <em>[1,k]</em> . Write a modified version of Prim's algorithm that returns the minimum spanning tree in <em>O(kn+m)</em> time.</p>
  
  <p>Note:</p>
  
  <ul>
  <li><em>n</em> represents the number of vertices</li>
  <li><em>m</em> represents the number of edges</li>
  </ul>