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.

Answers were Sorted based on User's Feedback



if array a conatins 'n' elements and array b conatins 'n-1' elements.array b h..

Answer / jay

Guys all this answer where work for integer but what about string and characters???????????????
they r not going to work on that!!!!!!!!!!

Is This Answer Correct ?    0 Yes 0 No

if array a conatins 'n' elements and array b conatins 'n-1' elements.array b h..

Answer / argho chatterjee

// Assuming arrays are sorted in ascending order
/*
it is not efficient if the number is found at the start of
the array.

It tries to break the array and find the position from the
middle and then again breaks till it find the position of
the array.
*/

public static void main(Array mainArray , Array
missingArray) {
int pointer = mainArray.length /2; // default is 0
return findMissingElement
(mainArray ,missingArray,pointer);

}

int findMissingElement(Array mainArray , Array
missingArray,pointer) {
if(mainArray[pointer] ==
missingArray[pointer] ) {
pointer = pointer + pointer /2;
return
findMissingElement
(mainArray ,missingArray,pointer);
}
else {
return mainArray[mainArray.length/i];
}
}

Is This Answer Correct ?    0 Yes 0 No

if array a conatins 'n' elements and array b conatins 'n-1' elements.array b h..

Answer / sanket

take first element of array a then compare with all the elements in array b.
if it matches take second element in array a and do the same like this u will get the missing elements.
and depending on the size of the array there are different methods..

Is This Answer Correct ?    0 Yes 1 No

if array a conatins 'n' elements and array b conatins 'n-1' elements.array b h..

Answer / ankith.v

Zero th element

Is This Answer Correct ?    0 Yes 4 No

if array a conatins 'n' elements and array b conatins 'n-1' elements.array b h..

Answer / bhavik

It is not true that there is a[0] missing.
Because as per my knowledge array is starting from a[0] and
running up to a[n] continuously.
But if my ans is wrong then sorry and please send me right ans.

Is This Answer Correct ?    6 Yes 12 No

if array a conatins 'n' elements and array b conatins 'n-1' elements.array b h..

Answer / rahul

define one variable say t_max and save a[0] in that,loop
through it, if a[1] is grater than a[0] save a[1] in t_max
otherwisw a[0] remain as it is....check it same way for all
elemnts in array...finally t_max will hold max elemnt from
array.

Is This Answer Correct ?    2 Yes 11 No

if array a conatins 'n' elements and array b conatins 'n-1' elements.array b h..

Answer / navs

a[n] is missing in b bcoz a contains n,(n-1),(n-2)....
and b contains n-1,n-2,.....so hear n is missing

Is This Answer Correct ?    1 Yes 11 No

if array a conatins 'n' elements and array b conatins 'n-1' elements.array b h..

Answer / guest

a[0]

Is This Answer Correct ?    3 Yes 32 No

Post New Answer

More C Interview Questions

Explain how are 16- and 32-bit numbers stored?

0 Answers  


Explain how can I right-justify a string?

0 Answers  


Write a c program to demonstrate character and string constants?

0 Answers  


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

0 Answers   Huawei,


which type of question asked from c / c++ in interview.

2 Answers  


without using control structures and control structures find the max and min of given 2 nos

1 Answers   HCL,


number 2 plssssss help !!....using array.. turbo c.. create a program that will accept a number and determine if it is a happy number or an unhappy number.. example: enter a number : 7 7*7=49 then 4 and 9 4*4 and 9*9== 16 + 18 gives you 97 then 9 and 7 9*9 and 7*7 == 81 + 49 gives you 130 then 1 and 3 1*1 and 3*3 == 1 + 9 gives you 10 1*1 gives you 1 sample output: 7= 49= 16+81= 97= 81+49=130 =1+9=10 =1 "7 is a happy number" . if the last number is 2 then the number being inputed is not a happy number.

3 Answers  


Can you write the algorithm for Queue?

0 Answers   College School Exams Tests, TCS,


What is return in c programming?

0 Answers  


can we write a c program with out using main

3 Answers  


1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

3 Answers  


How to write c functions that modify head pointer of a linked list?

0 Answers  


Categories