presentación-PDF
presentación-PDF
presentación-PDF
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Consideraciones sobre la eficiencia de<br />
un programa.<br />
public boolean Pertenece1 (int [] A, int X)<br />
{<br />
int i;<br />
boolean encontrado = false;<br />
for (i = 0; i < A.length; i++)<br />
{<br />
if (A[i] ==X)<br />
encontrado = true;<br />
}<br />
return encontrado;<br />
}<br />
public boolean Pertenece2 (int [] A, int X)<br />
{<br />
int i = 0;<br />
while (i < A.length - 1 && A[i] != X)<br />
i++;<br />
return A[i] == X;<br />
}<br />
¿Número de iteraciones?<br />
Pertenece1 --------- La media es n.<br />
Pertenece2 --------- La media es n/2.