Hi all;
There is a problem that i didnt understand..?Java assigns the initial value of defined variables.isnt it?I have a merge sort algorithm below but for C array the error is:
The local variable C may not have been initialized
in one of if and else statement C[ ] have to get a value...So i didnt understand whats the problem...Please dont say only,give an initial value to C[ ] :)
code is below; thanks for any suggestions
public static void MergeSirala(int[] A,int[] B) {
int i=1,j=1;
int n,m;
int[] C;
n=A.length;
m=B.length;
A[n]=B[m-1];
B[m]=A[n-1];
for(int k=0;k<n+m;k++)
{
if(A>B[j])
{
C[k]=A[i];
i++;
}
else
{
C[k]=B[j];
j++;
}
}
}