write a program for finding the union of two integer array
in java?

Answer Posted / satish kumar

void union(int x[],int y[])
{


int n=x.length + y.length ;
int z[]=new int[n];
int p=x.length;
for(int i=0;i<x.length;i++)
{
z[i]=x[i];
}
int j=0;
for(int i=0;i<y.length;i++)
{
for(j=0;j<x.length;j++)
{
if(y[i]!=z[j])
{
continue;
}
else
{
if(y[i]==z[j])

break;
}
}
if(j==x.length)
z[p++]=y[i];
}

Is This Answer Correct ?    32 Yes 24 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

difference between mantis and other tools?

1616


in IBM PC -AT.WAT AT REFERS TO?

1418


How can we develop a multi-tier application in Java?

1466


Given an array of size n+1 which contains all the numbers from 1 to n.Find the number which is repeated in O(n) time.How do you proceed with the same with floating numbers from 0 to 1 instead of 1 to n?

604


Give examples of macro quoting function?

1552






hoe to data grid use in sql server 2000?

1597


it is a language or tools?

1617


iam confused among testing ,.net and java. can anybody help me.

1570


What's the difference b/w Table & Templete in Smartform?

1638


You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?

601


How will you prove that java swing is multithreaded?

1694


could you please tell me how to draw the calibration curve for HPLC {the software which we are using}?

1287


How does the type system works when there is interoperability between a COM and .Net, i mean what exactly happens there

1562


Is there any standard procedure to test the application as a whole? Or How can I test complete application right from the requirement gathering?

1467


What is the use of Differ interface check box in Ship confirm?

1842