The dot product of two vectors A and B, each of size n, is
int product=0; for (int i=0; i<=n; i++)product+=A[i]*B[i] (Calculation 1)
In this assignment, you write C++ programs that compute the dotproduct of two given vectors (see Calculation 1 above). In theseprograms, in vectors A and B only nonzero elements are stored. Usearray of structures to store non-zero elements.
The following is an example:
Input n: 10
Enter nonzero elements in A
Index val
2 7
4 5
7 8
9 4
Enter nonzero elements in B
Index val
3 5
4 6
9 5
Output: Dot-product AB is 50
Good Luck
Expert Answer
An answer will be send to you shortly. .
PayPal Gateway not configured
PayPal Gateway not configured