A
UBB · Informatică
132

Se consideră algoritmul X(n), unde n este un număr natural nenul (1n1041 \le n \le 10^4).

Algoritm 1

Algorithm X(n)
  s ← 0
  ind ← n
  While ind > 0 execute
    j ← 1
    While j ≤ ind execute
      s ← s + j + 5
      j ← j * 5
      ind ← ind DIV 5
    EndWhile
  EndWhile
  Return s
EndAlgorithm

Care este complexitatea de timp a algoritmului X(n)?

6 / 8