+ 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 .

24th Nov 2018, 11:10 AM
Braken Mohamed
Braken Mohamed - avatar
2 Answers
+ 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
25th Nov 2018, 10:53 AM
Hamza Alalach
Hamza Alalach - avatar
0
thanks i'll join the code
25th Nov 2018, 4:05 PM
Braken Mohamed
Braken Mohamed - avatar