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


Please Help Members By Posting Answers For Below Questions

Write a program to find factorial of a number using recursive function.

833


What is the mean of function?

828


What does a function declared as pascal do differently?

785


What are the features of c languages?

808


what is uses of .net

1447






What is static memory allocation?

819


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

801


How do we open a binary file in Read/Write mode in C?

941


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2260


What are header files in c programming?

818


When should you use a type cast?

789


What is infinite loop?

823


What is class and object in c?

788


Linked lists -- can you tell me how to check whether a linked list is circular?

835


What are reserved words?

833