+ 1
How can we calculate the complexity of pgcd's algorithme
i would like to know how to calculate the PGCD' s algorithm, so the algo is easy but it's hard to calculate its complexity .
2 Antworten
+ 1
Hi! It would be great if you just put the algorithm along with your question, but if I can remember, it only has a one while loop, with some variables declarations and affectations.
Even if you see a while loop (It's not clear when it does end) but it always finite, and the numbers we work with are in IN. So if we take an n in IN which represents how many times the loop will run for and a m: the number of operations in the loop, the complexity is the following:
m*O(n) = O(n): linear
0
thanks i'll join the code