write a program for finding the union of two integer array
in java?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / nadeem khokhar
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 ? | 14 Yes | 26 No |
< DL Compact > tag is used for
What language / script is used to validate web page
hai i am prasanna.I am MCA 2009 fresher.tell me about certifications.which certification helps me to improve my carrier and to get a technically oriented job ,which certification helps to get job faster.
Code for display the images from drive using vb 6.0?
what is the filters in biztakk server? where it can use?
I am looking for NIC Sample papers or any patern of questions/ syllabus plz, send me on hamid.khan135@yahoo.in Regard
How many ways we can fill a dataset in .Net
public static void main(String args[]) describe it
how do u handle table control inbdc explain the process in steps iwant the answer in urgent please forward this even i know how to explain there
Fortran cannot have value by reference True or False?
What is dialog programming?
hai i like to do some certifications in programming or any other......... am doing my IT third year......... pls guide me...... mail me ur suggestions to ranjithmaharaj@gmail.com...