Hello everyone,
I have been given an assignment to code and then find the time complexity of Euclid's algorithm. The code is as follows:
I had no issues on that part. However, I have no idea how to go about finding the worst case and average case efficiencies.
I tried looking online for some information, but it is all flying over my head.
Hopefully someone here can help.
I have been given an assignment to code and then find the time complexity of Euclid's algorithm. The code is as follows:
int gcd(int m, int n) {
int r;
while (n != 0) {
r = m % n;
m = n;
n = r;
}
return m;
}
I had no issues on that part. However, I have no idea how to go about finding the worst case and average case efficiencies.
I tried looking online for some information, but it is all flying over my head.
Hopefully someone here can help.