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 |
What is the difference between CriteriaQuery and CreateQuery in Hibernate???? Thanks in advance!!!!!!
I want sample papers for NIC Examination. Plz send them to my mail Id das.neelam@gmail.com . Plz send it today, tomorrow i've the exam.
how many logical drive we can form to physical device in our computer?
3.Give the formula for determine the range of the data type?
5. Which of the following can you do with DB2 Express- C? Query databases with SQL Query databases with XML using XQuery and XPath Use SQL in Xquery and Xquery in SQL All of the above
what is difference between input parameter and output parameter.
I am looking for selenium RC online Training in chennai. can any one tell me the best institute
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?
how many languages .net is supporting now?
hoe to data grid use in sql server 2000?
How many ways we can fill a dataset in .Net
give idea for creating screen in abap