Give two integer arrays A & B.A has n elements and B has ' n-1 ' elements . A has all the elements that are there in B. But B has one missing element. Write a function that takes arrays , A & B as imnput and finds the missing element in most optised manner .

Answer Posted / aniruddha

public int check(int a[], int b[])
{  int value,w;
   for(int i=0; i<=a.length; i++)
   {  w=0;
      for(int j=0; j<b.length; j++)
      {  
         if(a[i]!=b[j])
         {  w++;
            break;
         }
      }
      if(w==0)
      value=a[i];
   }
   return value;
}

Is This Answer Correct ?    12 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Q1. A. What is unary operator? List out the different operators involved in the unary operator. B. What is an adjust field format flag? Q2. A. Distinguish between a # include and #define. B. Can a list of string be stored within a two dimensional array? Q3. A.Explain how a pointer to function can be declared in C++? B.List the merits and demerits of declaring a nested class in C++? Q4. A. What are the syntactic rules to be avoid ambiguity in multiple inheritence? B. Explain the operation of overloading of an assignment operator. Q5. A. Explain how the virtual base class is different from the conventional base classes of the opps. B. Explain how an exception handler is defined and invoked in a Program. Q6. A. What is a binary file? List the merits and demerits of the binary file usagein C++. B. Write short notes on Text Manipulation Routines. C. Write bites in Turbo c++ Header (“Include”) Files.

2307


Is stl part of c++ standard?

637


How stl is different from the c++ standard library?

639


What does stl stand for in basketball?

638


What is the stl, standard template library?

592






How connect plc and pc through software

1915


write a program to convert a decimal number in to its equivalent binary number?

2075


Can we use stl in coding interviews?

1272


What does stl mean in slang?

647


Is there any error below, its a code to delete all entires from a map #include #include iostream.h int main() { int i =0; map TestMap; while(i<3) { TesMap.insert(TestMap::value_type(i,Test)); i++; } typedef map :: iterator mapIter =TestMap.begin(); if(mapIter!=TestMap.end()) { TestMap.erase(mapItrer); ++mapIter; } return 0; }

1889


what is template and type convertion

1992


help me i need a c++ program which takes sequesnce of characters and outputed sequence of their token taypes, work same compiler in lexical analysis phase

1879


What are the various types of stl containers?

727


What do stl stand for?

635


What is a list in c++ stl?

689