Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new

 Categories >> Software >> Programming Languages >> Programming Languages AllOther

 C Interview Questions (2266) C++ Interview Questions (1121) VC++ Interview Questions (342) Delphi Interview Questions (510) Programming Languages AllOther Interview Questions (652)
Question
```write a program for finding the union of two integer array
in java?```
Question Submitted By :: Programming-Languages-AllOther
I also faced this Question!!     Answer Posted By

# 1
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 ? 22 Yes 20 No
Satish Kumar

# 2
the above mentioned code is also good one. but i m giving you an algorithm you can say, so you can get the concept and convert it into any language
int a[3]=1,2,3;
int b[3]=2,3,4;

for(int i=0; i <=2; i++)
{

for(int j=0; j<=2; j++)
{

if(a[i] == b[j])
cout<<a[i]; is a union of a and b
}
}

 Is This Answer Correct ? 12 Yes 18 No

  Question Asked @ Answers Other Programming Languages AllOther Interview Questions how to swap all the values without using temporary variable. tha values r a = 20, x=60 and p=2. DST-Global-Solutions 5 How can we alter the data after creating a view 1 What is the difference between CriteriaQuery and CreateQuery in Hibernate???? Thanks in advance!!!!!! Accenture 1 How to use string functions in QTP?give some examples 1 how can i apply validation without using errorprovider in C# windows application 1 How to find the aerry size Cap-Gemini 1 how to invoke the macro in another macro? Accenture 1 How many processes can listen on a single TCP/IP port? 2 Please anyone tell me coding to print prime numbers from 1 to 5000 in c#.... 2 In Bioinformatics, a DNA sequence is made up of a combination of 4 characters, namely A,C,G,T. A subsequence of a given sequence of characters a0, a1, an- 1, is any subset of the characters taken in order, of the form ai0 , ai1 ,..aik-1 where 0 ≤ i0