Блог пользователя Duelist1234

Автор Duelist1234, история, 9 месяцев назад, По-английски

What is the time complexity of the Euclidean Algorithm? Also please upvote im really down bad with the downvotes and i want to return to positive contribution. Edit: When i meant the contribution i was hoping to get massivly downvoted.

  • Проголосовать: нравится
  • -12
  • Проголосовать: не нравится

»
9 месяцев назад, # |
  Проголосовать: нравится -15 Проголосовать: не нравится

$$$gcd(a, b)$$$ works in $$$log(a) + log(b)$$$ time

  • »
    »
    9 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I see my comment got downvoted:( Can somebody please explain why it is $$$log(min(a, b))$$$? I always thought that every step one of the variables is decreased at least two times. Why am I wrong?

»
9 месяцев назад, # |
  Проголосовать: нравится +18 Проголосовать: не нравится

Short answer: log(min(a, b)).

Long answer: Stack Overflow my beloved There are multiple explanations for why the time complexity may or may not be something. The case when A and B are very large numbers is also tackled. Really cool!

»
9 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Euclidean algorithm's time complexity is often denoted as O(log(min(a,b))).

»
9 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Duelist1234 (previous revision, new revision, compare).