Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

What does it mean when a pointer is used in an if statement?

0 Answers  


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

2 Answers   Aricent, Manipal University,


What is external and internal variables What is dynamic memory allocation what is storage classes in C

3 Answers  


to convert a string without using decrement operater and string functions

1 Answers  


What character terminates all strings composed of character arrays? 1) 0 2) . 3) END

3 Answers  


Is an array parameter is always "by reference" ?

1 Answers  


What is 1f in c?

0 Answers  


How does C++ help with the tradeoff of safety vs. usability?

1 Answers  


main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output??

19 Answers   EBS, Ramco, Sangwin, TCS,


Why pointers are used?

0 Answers  


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

0 Answers  


Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.

0 Answers  


Categories