title: Pathway/road laying problem
body: <p>Today we got an assignment to complete in lab (in two hours). The question was: </p>
  
  <ul>
  <li>You're given an m*n matrix.</li>
  <li>The matrix has 'h' residential halls and 'b' main building entrances.</li>
  <li>The location of these 'h' halls and 'b' entrances is known (in terms of (x,y) coordinates).</li>
  <li>You need to lay pathways such that every residential hall has at least one way to reach one of the 'b' entrances.</li>
  <li>There can be at most 'b' such disconnected pathways.</li>
  <li>The length of the pathway must be minimum.</li>
  <li>You can only move up, down, left or right.</li>
  <li>The solution must not be a brute force attempt.</li>
  </ul>
  
  <p>The assignment is over. But I'm still thinking how this would be solved. Is there a standard term for such problems? What should I read up?</p>
  
  <p>Do people use such algorithms to laying roads in cities as well?</p>