C++ program to find minimum scalar of two vectors
Minimum scalar product of two vector
In this section we learn about the minimum scalar product of two array.
There are we have a two array That is array 1 and array 2 so here we need to find the dot product of the two array. Dot product is also known as the scalar product of two vector.
For finding the minimum scalar product of arrays we need to multiply the minimum value of first array to the maximum value of the second array and add these corresponding products to result.
- Initialize two array.
- Take the element for both array,
- Sort the both array by calling sort method.
- print the minimum scalar product by calling MScalarProduct().
- initialize sum variable.
- initialize for loop from 0 to size of an array.
- multiply array same index element and add this with sum and store it in same variable.
- return the sum;
- sort the array1 in ascending order.
- sort the array2 in descending order.