doesn't it make more sense to have this function return a success instead of indicating an error by setting the values in the array to INIFINITY? you also are not describing this behavior in the header