13.04.2013 Views

Análise de complexidade - UFMG

Análise de complexidade - UFMG

Análise de complexidade - UFMG

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

-<br />

-<br />

1<br />

n<br />

n<br />

-<br />

1<br />

-<br />

int soma_acumulada(int n) {<br />

int i;<br />

int acumulador = 0;<br />

for(i = 0; i < n; i++) {<br />

acumulador += i;<br />

}<br />

return acumulador;<br />

}<br />

Qual a função <strong>de</strong> complexida<strong>de</strong> do número<br />

<strong>de</strong> atribuições para o acumulador?<br />

Qual a or<strong>de</strong>m <strong>de</strong> complexida<strong>de</strong> da função<br />

soma_acumulada?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!