Hi,
This is Muthuvel. Recently, I attended Finatel Technologies Interview. Here, I am posting one of the Finatel Technologies Interview Programs with Answers. Please have a look. The program asked in Finatel is, I am given with two arrays of integers. Both the arrays are not sorted. I am requested to merge both the arrays in sorted order. One condition given is – I should not use any in built methods to sort the arrays. I tried a lot to get the output and here is my outcome. Kindly go through and let me eagerly wait for your feedback.

Finatel Technologies Interview Programs with Answers

public class FinatelMergeTwoArrays {
public static void main(String[] args) {
int[]a = {9,7,3,5,1};  // First Array, not sorted
int[]b = {2,4,6,8,11,10}; // Second Array, not sorted 
int[]c = new int[a.length+b.length];  // Third Array to be created 
int count = 0;int v=1;  // check ‘v’ is initialized here
for(int i = 0; i<a.length; i++) {
c[i] = a[i];  // Adding array a’s contents to c array
count++;
}
for(int j = 0;j<b.length;j++) {
c[count++] = b[j];  // Adding array b’s contents to c array

}

for(int i = 0;i<c.length;i++){
for(int k=0;k<c.length;k++){
if(c[k]==v){  // verifying the value to print is ‘v’ or not.  
System.out.print(c[k] + ” “);

 

}
}
v++;
}

}

Output: 

1 2 3 4 5 6 7 8 9 10 11