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
what are # pragma staments?
What does the error message "DGROUP exceeds 64K" mean?
How can I sort more data than will fit in memory?
What is wrong with this code?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
Why pointers are used in c?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
Combinations of fibanocci prime series
What is c preprocessor mean?
Can we change the value of #define in c?
the question is that what you have been doing all these periods (one year gap)
Is stack a keyword in c?
Do you know what are bitwise shift operators in c programming?