| µ¿ÀûÇÁ·Î±×·¡¹Ö °³³ä | µ¿ÀûÇÁ·Î±×·¡¹Ö »ç·Ê | ºÐÇÒÁ¤º¹°ú µ¿ÀûÇÁ·Î±×·¡¹Ö ºñ±³ |
µ¿Àû ÇÁ·Î±×·¡¹Ö »ç·Ê
¡á ÇǺ¸³ªÄ¡ ¼ö½ÄÀ» °è»êÇÏ´Â ÇÔ¼ö
---------------------------------------------
unsigned int fib( unsigned int n )
{ if( n <= 1 )
return 1;
else
return( fib( n-1 ) + fib( n-2 ) );
}
ºñ´É·üÀûÀÎ ÇǺ¸³ªÄ¡¼ö °è»ê ¾Ë°í¸®Áò
À§ ÇǺ¸³ªÄ¡ ÇÔ¼öÀÇ ¼öÇà½Ã°£Àº O(2N)ÀÌ´Ù.
T(N) >= T(N-1) + T(N-2)À̹ǷΠ¼öÇà½Ã°£ÀÌ Áö¼öÀûÀ¸·Î Áõ°¡ÇÔ
(¿¹) N=5À϶§