Prim and greed algo