Computer Science, asked by sajalkhandelwal6101, 1 year ago

Program to count the no of element which are not common in atwo distinct given array

Answers

Answered by Nithin220802
10

HERE IS YOUR ANSWER:-

/ / C++ program to find uncommon elements of two sorted arrays

#include <iostream>

using namespace std;

void print uncommon(int arr1 [ ] ,int arr2 [ ] ,int n1, int n2)

{

Answered by vedha652000
8

Answer:

12

Explanation:

#include<iostream>

#include<map>

using namespace std;

int main()

{

int n1;

   cin>>n1;

   int n2;

   cin>>n2;

   int a1[n1];

   int a2[n2];

   multimap<int,int> m;

   multimap<int,int> m1;

   for(int i=0;i<n1;i++)

   {

    cin>>a1[i];

    m[a1[i]]++;

}

int c=0;

for(int i=0;i<n2;i++)

{

 cin>>a2[i];

 m1[a2[i]]++;

 if(m.find(a2[i])==m.end())

 {

   c++;  

 }

}

for(int i=0;i<n1;i++)

   {

    cin>>a1[i];

    if(m1.find(a1[i])==m.end())

 {

   c++;  

 }

}

  cout<<c<<endl;  

}

Similar questions