modified the length of the array allocated to 4*ceil(n/3)