A
UBB · Informatică
198 Raspunsuri multiple

Se consideră algoritmul ceFace(st, dr, n, m, matrix), unde n și m sunt numere naturale nenule (1 ≤ n, m ≤ 10^3), iar matrix este o matrice de n × m numere naturale nenule (1 ≤ matrix[i][j] ≤ 10^6).

Algoritm 1

Algorithm ceFace(st, dr, n, m, matrix)
  If st = dr then
    Return matrix[st][2]
  EndIf
  mid ← (st + dr) DIV 2
  a ← ceFace(st, mid, n, m, matrix)
  b ← ceFace(mid + 1, dr, n, m, matrix)
  Return a + b
EndAlgorithm

Pentru care dintre următoarele valori ale lui n, m și matrix, apelul ceFace(1, n, n, m, matrix) returnează 31?

11 / 30