if array a conatins 'n' elements and array b conatins 'n-1'
elements.array b has all element which are present in array
a but one element is missing in array b. find that
element.
Answer Posted / venu
use XOR association operation.
I mean: a = b^a^b = a^b^b = a;[bec a^a =0 always]
int main()
{
int a[3] = {3,4,5};
int b[4] = {7,4,5,3};
int r,i;
int n=4;
r1 = b[3];
for(i=0;i<n-1;i++)
{
r1 = r1^a[i]^b[i];
}
printf("number = %d \n",r);
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
When should you use a type cast?
What is #include called?
string reverse using recursion
Are there constructors in c?
What are the 32 keywords in c?
Why we use stdio h in c?
How can I manipulate strings of multibyte characters?
What are the types of data files?
What is the difference between array and pointer?
When should a far pointer be used?
How will you find a duplicate number in a array without negating the nos ?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
What are the advantages of Macro over function?
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
What is LINKED LIST? How can you access the last element in a linked list?