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

write a c programs to do multiplication of two numbers with out using arithmatic operator ??????????

7 Answers   Infosys, TCS,


What is an example of structure?

0 Answers  


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

0 Answers  


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

0 Answers  


Write a program to add the following ¼+2/4+3/4+5/3+6/3+... (Like up to any 12 no.s)

1 Answers   HTC,






write program on arrays

3 Answers   GE, Polycab,


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

0 Answers   Amazon,


Write a program to generate the first n terms in the series --- 9,11,20,31,...,82

1 Answers   Cognizant,


A marketing company wishes to construct a decision table to decide how to treat clients according to three characteristics: Gender, City Dweller, and age group: A (under 30), B (between 30 and 60), C (over 60). The company has four products (W, X, Y and Z) to test market. Product W will appeal to female city dwellers. Product X will appeal to young females. Product Y will appeal to Male middle aged shoppers who do not live in cities. Product Z will appeal to all but older females.

2 Answers  


#include<stdio.h> main() { int a[3]; int *I; a[0]=100;a[1]=200;a[2]=300; I=a; Printf(“%d\n”, ++*I); Printf(“%d\n”, *++I); Printf(“%d\n”, (*I)--); Printf(“%d\n”, *I); } what is the o/p a. 101,200,200,199 b. 200,201,201,100 c. 101,200,199,199 d. 200,300,200,100

1 Answers  


What is variable in c example?

0 Answers  


What are preprocessor directives?

0 Answers  


Categories