This method converts a frequency array into a cumulative frequency array. For example if the initial array was { 1, 2, 3, 4} calling the method should give you { 1, 3, 6, 10}
This is what Ive written:
public void cumulate(int[] a)
{
for (int i= 0; i < a.length; i ++){
a[i] = a[i-1] + a[i];
}
}
I'm certain its wrong, but I do need help with generating another set of codes. If anyone is able to assist me, that would be lovely!