19.05.2013 Views

Algoritmos e Estruturas de Dados I

Algoritmos e Estruturas de Dados I

Algoritmos e Estruturas de Dados I

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Medindo o tempo <strong>de</strong>corrido<br />

● Como medir o tempo <strong>de</strong> uma or<strong>de</strong>nação?<br />

// Não se esqueça <strong>de</strong> incluir a biblioteca time.h<br />

#inclu<strong>de</strong> <br />

int inicio, final;<br />

int tempo_ms;<br />

start = (int) clock();<br />

// chamada da função <strong>de</strong> or<strong>de</strong>nação<br />

final = (int) clock();<br />

tempo_ms = ((final - inicio) * 1000 / CLOCKS_PER_SEC);<br />

printf("%d", tempo_ms);

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

Saved successfully!

Ooh no, something went wrong!