logo

Crowdly

Quantos acessos ao vetor (array) é que o fragmento de Código abaixo efectua, com...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Quantos acessos ao vetor (array) é que o fragmento de Código abaixo efectua, como função de n ? (assuma que o compilador não otimiza nenhum acesso ao vetor no ciclo mais interior).

1       int sum = 0;

2       for (int i = 0; i < n; i++)

3           for (int j = i+1; j < n; j++)

4               for (int k = 1; k < n; k = k*2)

5                    if (a[i]+a[j] >= a[k]) sum++;

More questions like this

Want instant access to all verified answers on moodle24.iscte-iul.pt?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!