✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
What is the time complexity of the following algorithm?
Shift(a[0..n-1])i ← 0
sum ← 0;
WHILE i < n
sum ← sum + a[i]
i ← i+1
average ← sum / n
i ← 0
WHILE i < n
a[i] ← a[i]-average
i ← i+1