1. (40 points) Here’s an interesting algorithm:int anyEqual ( int n , A [ ] [ ]) { int i, j, k, m; for (i = 1; i for (j = 1; j for (k = 1; k XXXXXXXXXXfor (m = 1; m XXXXXXXXXXif (A[i] [j] == A [k] [m]...

1 answer below »
1. (40 points) Here’s an interesting algorithm:int anyEqual ( int n , A [ ] [ ])
{ int i, j, k, m; for (i = 1; i for (j = 1; j for (k = 1; k for (m = 1; m if (A[i] [j] == A [k] [m] && ! (i == k && j == m) return 1; return 0;}Write a function in C++ that implements this algorithm.2. (50 points) Let’s test the behavior of the performance behavior of this algorithm. Write a program that loops for array sizes of the 10, 20, 30, 40, 50, 100, 500, and 1000 that for each array size will loop 20 times to randomly fill an array of that size, execute the function from the previous question, and compute the average time the function used to do whatever it’s doing. Print a table with array sizes and the average for each array size.






Answered 1 days AfterMar 13, 2022

Answer To: 1. (40 points) Here’s an interesting algorithm:int anyEqual ( int n , A [ ] [ ]) { int i, j, k, m;...

Arun Shankar answered on Mar 15 2022
109 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here