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

Hai, My name is nisha.I have NIC exam.If anybody Knows NIC previous paper pattern pls send me to nishanairp@gmail.com

1754


WS-NUM PIC S9(05)V(02) SIGN TRAILING SEPARATE MOVE '0050000+' TO WS-NUM The value stored is 00500,00+ MOVE '0050000-' TO WS-NUM Then what is the value will be stored in WS-NUM? Am getting '-00500,00'.....>>> What should I declare to WS-NUM so that I can get correct values for both + & - signs.

1859


In loading programs into memory, what is the difference between load-time dynamic linking and run-time dynamic linking?

1618


Give examples of macro quoting function?

1556


why we use abstract in awt?

1566






What are the tasks performed by a Team Lead

2337


I am work in it aompenei

979


WHAT IS MAIN IMPORTANT THING IN SOFTWARE?

1729


Differevce between arrays and array builders?

1649


what is the extension of SPDS Dynamic cluster tables?

1632


1. Write a program to create a sentence at runtime and count number of vowels in it ? 2. Write a program to get a string and to convert the 1st letter of it to uppercase ?

3216


along with oracle which language will be beneficial to have knowledge with,java,.net,since i m doing oracle have appeared for 8th sem BEIT,plz suggest

1395


Find out the list of roles which gives access to GUI activities? thanks in advance

1737


how to convert infix expression to prefix expression?

3831


What is the purpose of element of in Ajax

2019