A
UBB · Informatică
224

Se consideră algoritmii back(x, n, k) și ok(x, k), unde x este un vector, n și k sunt numere naturale.

Algoritm 1

Algorithm back(x, n, k)
  For i ← n, 1, −1 execute
    x[k] ← i
    If ok(x, k) = 1 then
      If k = n then
        print(x, n)
      Else
        back(x, n, k+1)
      EndIf
    EndIf
  EndFor
EndAlgorithm

Algoritm 2

Algorithm ok(x, k)
  For i ← 1, k − 1 execute
    If x[k] = x[i] then
      Return 0
    EndIf
  EndFor
  Return True
EndAlgorithm

Care dintre următoarele afirmații sunt adevărate?

7 / 22