12.07.2015 Views

Cap. 4 Complejidad temporal de algoritmos - Inicio

Cap. 4 Complejidad temporal de algoritmos - Inicio

Cap. 4 Complejidad temporal de algoritmos - Inicio

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.

42 Estructuras <strong>de</strong> Datos y AlgoritmosProblemas resueltos.P4.1Determinar la solución <strong>de</strong> la siguiente relación <strong>de</strong> recurrencia:T(n) = T(n/2) + n, con T(1)= 2.Si es necesario pue<strong>de</strong> emplear que la suma <strong>de</strong> la siguiente progresión geométrica es:¿Cuál es el or<strong>de</strong>n <strong>de</strong> complejidad?Solución.T(2) = T(1) + 2 = 4 = 2 2T(4) = T(2) + 4 = 8 = 2 3T(8) = T(4) + 8 = 16 = 2 4T(16) = T(8) + 16 = 32 = 2 5T(2 i ) = T(2 i-1 ) + 2 i = 2 i+1 =2*2 iCon 2 i = n, se obtiene la solución:T(n) = 2*nEntonces: T(n) es ( n ), para todo n.ni12 ( n1)22 i Ya que existen c1, c2 y n 0 tales que:c1 f(n)

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

Saved successfully!

Ooh no, something went wrong!