As I said before the arraySize is not accurate.
arraySize = collSize/3 + 1; //not accurate though, consider size = 10
int[] a = new int[arraySize];
int[] b = new int[arraySize];
int[] c = new int[arraySize];
Below is a solution to compute right array size.
In case of 10 elements you need three arrays with 4, 3, 3 elements respectively
In case of 11 elements you need three arrays with 4, 4, 3 elements respectively
In case of 12 elements you need three arrays with 4, 4, 4 elements respectively
So the ArraySize can be different for all arrays.
Say aArraySize, BArraySize, cArraySize
After dividing the size by 3 you get a fraction,
If this fraction is zero (3/3), aArraySize = bArraySize = cArraySize = size/3;
If this fraction is .33 (1/3) or less than .5
aArraySize = size/3 + 1; bArraySize = cArraySize = size/3;
If this fraction is .66(2/3) or greater than .5
aArraySize = bArraySize = size/3 + 1; cArraySize = size/3;
To find the fraction you can do
fraction = size/3 - (int)size/3
[ December 21, 2005: Message edited by: jiju ka ]
[ December 21, 2005: Message edited by: jiju ka ]