Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I just need to change the two arrays into two vectors in this function. I need help, I don't know the right syntax. // C++

I just need to change the two arrays into two vectors in this function. I need help, I don't know the right syntax.

// C++ Code to find Smallest Difference between two Arrays #include using namespace std;

// function to calculate Small result between two arrays int findSmallestDifference(int arr1[], int arr2[], int m, int n) { // Sort both arrays using sort function sort(arr1, arr1+m); sort(arr2, arr2+n);

int a = 0, b = 0;

// Initialize result as max value int result = INT_MAX;

// Searching Both Arrays upto sizeof of the Arrays while (a

// Move Smaller Value if (arr1[a] < arr2[b]) a++;

else b++; }

return result; // return final smallest result }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

4. Develop a self-directed learning module.

Answered: 1 week ago

Question

2. Provide recommendations for effective on-the-job training.

Answered: 1 week ago