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

Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number

727


what is the BAM? where we can use it in BizTalk server?

1356


Given a set. Write the pseudo code to get all the subsets for the given set. Eg. Input : {1,2} Output : (),(1),(2),(1,2)

2226


I need source code for Enrollment System using Visual Basic 6.0/2008 database MS Access 2007 for my school thesis project...please help me..kindly send in my email jpinedamcp@gmail.com

1582


what are the 3 forms of a prolog term

2753






5. How do you round the addition or subtraction of two numbers in assembler?

1774


which worker is involved in all the phases of SDLC?

1702


Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)

756


any drawback are there in mantis?

1642


Which method protects back button to retrieve old value from previous page in Struts.

1451


difference between mantis and other tools?

1618


What is %Type,%Rowtype?

1840


Why did you ever become involved in QA/testing?

1606


what is integration testing in real time applications?

1847


how do i add a column dynamically in a table by using java application?

1545