Create Prims Algorithm using array