the algorithm is now using integers because of the failure in the atempt to have a generic algorithm that uses operators (<, >, etc)