22.06.2015 Views

Capítulo 3 Complejidad de algoritmos recursivos ⎩ ⎨ ⎧ = > − = 0 1 0 ...

Capítulo 3 Complejidad de algoritmos recursivos ⎩ ⎨ ⎧ = > − = 0 1 0 ...

Capítulo 3 Complejidad de algoritmos recursivos ⎩ ⎨ ⎧ = > − = 0 1 0 ...

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.

Instituto Tecnológico <strong>de</strong> Ciudad Ma<strong>de</strong>ro<br />

Unidad I COMPLEJIDAD DE ALGORITMOS<br />

Dra. Laura Cruz Reyes<br />

Capítulo 3 <strong>Complejidad</strong> <strong>de</strong> <strong>algoritmos</strong> <strong>recursivos</strong><br />

Tn ( ) =Ο( ⎢⎣n⎥⎦<br />

)<br />

Reducir el límite superior y elevar el límite inferior hasta que converjan en el correcto<br />

T(n) = Θ(nlgn)<br />

c) Convertir una suposición inductiva débil en una fuerte, restando el término <strong>de</strong> más bajo<br />

or<strong>de</strong>n.<br />

Suposición inductiva débil<br />

Recurrencia a resolver:<br />

T( n) = 2 T( ⎢⎣n/2 ⎥⎦) + 2 T( ⎡⎢n/2 ⎤⎥<br />

) + 1<br />

Adivinación <strong>de</strong> la fórmula <strong>de</strong> la solución:<br />

Tn ( ) = On ( )<br />

Hipótesis inductiva: existe una c>0 que haga cierto que,<br />

Tn ( ) ≤ cn ( )<br />

Sustitución en la recurrencia <strong>de</strong> la hipótesis inductiva evaluada en k f-1 = n/2<br />

T( n) ≤ cn /2 + cn /2+<br />

1<br />

Tn ( ) ≤ cn+<br />

1<br />

La hipótesis inductiva se rechaza ya que no existe una c que haga cierta la hipótesis en la<br />

recurrencia ya que para toda c>1, cn≠ cn+1<br />

Suposición inductiva fuerte<br />

El término <strong>de</strong> más bajo or<strong>de</strong>n <strong>de</strong> la recurrencia es 1, el cual se resta <strong>de</strong> la hipótesis<br />

inductiva como una constante, quedando:<br />

Tn ( ) ≤cn ( ) −b, con b≥<br />

0<br />

Sustituyendo en la recurrencia la hipótesis inductiva evaluada en k f-1 = n/2 se tiene:<br />

Tn ( ) ≤cn/2 − b+ cn/2− b+<br />

1<br />

Tn ( ) ≤cn− 2b+<br />

1<br />

Para b=1 la recurrencia y la hipótesis coinci<strong>de</strong>n<br />

Recurrencia

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

Saved successfully!

Ooh no, something went wrong!