## 9/05/2011

### What is a Recursive Call? and Make Fibonacci sequence function using Function of the Recursive Call type.

Recursive call is that this method call oneself.
Specially, Function uses this method.
Below C Source is example for recursive call function.
As you see, Function RF called the RF that is name of oneself.

Now I give you one question.
Please make Fibonacci sequence function using recursive call method.

You can see Fibonacci condition <here>

The LINUX that is name of OS is also recursive call type.
Some people said " LINUX is abbreviation of LINUX is not UNIX. "
Here, LINUX is call LINUX is not UNIX. In this sentence, LINUX is call LINUX is not UNIX again..
so..like that

(((((LINUX is not UNIX) is not UNIX) is not UNIX) is not UNIX) is not UNIX) is not UNIX

This case sink into the infinity roof because there is not escape condition. so we have to be careful when we use recursive call.

<English is very difficult.. Plz someone correct my poor sentence.>

์ฌ๊ทํธ์ถ์ด๋ ์๊ธฐ๊ฐ ์๊ธฐ์์ ์ ํธ์ถํ๋ ๋ฐฉ์์ ๋งํ๋ค.
ํนํ ํจ์์์ ์ด๋ฐ ์ผ์ ํ๋ค.
์ด๋ฐ ์ฌ๊ทํธ์ถ ํจ์๊ฐ ํ์ํ ๊ฒฝ์ฐ๋
์ด๋ค ์ผ์ ํ๋ ํจ์๊ฐ ์ฌ๋ฌ๊ฐ์ง ์กฐ๊ฑด์ ๋ํ์ฌ ๋๊ฐ์ ์ผ์ ํ  ํ์๊ฐ ์์ ๋์ด๋ค.
๊ทธ๋ฐ๋ฐ ๋ค์ ์ฌ๋ฌ๊ฐ์ง ์กฐ๊ฑด์ด ์ฃผ์ด์ง๊ณ  ๋๋ค์ ๊ฐ์ ์ผ์ ํด์ผํ  ๋ ์ฌ๊ท ํธ์ถ ํจ์๋ฅผ ์ด๋ค.
์ด๊ฑด ๋ง๋ก ํํํ๊ธฐ ๋ฌด์ฒ ์ด๋ ต๋ค.. ใใ

ํ๊ฐ์ง ์์ ๋ฅผ ๋ณด์

----------------------------------------------

int RF(int A);

void main()
{
printf("%d\n", RF(5) );
}

int RF(int A)
{
int B=0;
if(A>1)
{
B = RF(A-1);
}

return A+B;
}

------------------------------------------------

RFํจ์๋ 1์์ ์๋ ฅ๋ ์ซ์๊น์ง ๋ํ๋ ํจ์์ด๋ค.
RFํจ์๋ฅผ ๋ณด๋ฉด ๋ณธ๋ฌธ์์ ๋ค์ ์๊ธฐ ์์ ์ ํธ์ถํ๋ ๊ฒ์ ๋ณผ ์ ์๋ค.
์ด๋ฐ ๋ฐฉ๋ฒ์ ์ฌ๊ทํธ์ถ์ด๋ผ๊ณ  ํ๋ค.

์ฌ๊ธฐ์ ๋ฌธ์ ๊ฐ ๋๊ฐ๋๋ค.
์ด๋ฐ ์ฌ๊ทํธ์ถ ๋ฐฉ์์ ์ด์ฉํ์ฌ ํผ๋ณด๋์น ์์ด์ ๊ฐ์ ๊ตฌํ๋ ํจ์๋ฅผ ๊ตฌํํด ๋ณด์์ค.
์ด๋ฒ์๋ ์ข ์ด๋ ค์ธ ๊ฑธ.. ใใ

์ด๋ฐ ๊ฒ๋ ์ฌ๊ท ํธ์ถ์ผ๊น?
LINUX ๋ผ๋ ์ด์์ฒด์ ๊ฐ ์๋ค.
๊ทธ๋ฐ๋ฐ ์ด๊ฒ์ LINUX is not UNIX์ ์ฝ์๋ผ๊ณ  ํ๋ค. ๊ทธ๋ฐ๋ฐ ์ฌ๊ธฐ์ LINUX๋ ๋ค์ LINUX is no UNIX๋ฅผ ๋ง๋ ๋ค.

๋ฐ๋ผ์ ..
(((((LINUX is not UNIX) is not UNIX) is not UNIX) is not UNIX) is not UNIX) is not UNIX

LINUX is not UNIX์์ LINUX๊ฐ ๊ณ์ LINUX is not UNIX๋ฅผ ์์ฑํด ๋ธ๋ค..
์ด๋ ๋ฏ ์ฌ๊ทํธ์ถ์ ์กฐ๊ฑด ๋ฌธ์ผ๋ก break๋ฅผ ์ ํด์ฃผ์ง ์์ผ๋ฉด ๋ฌดํ ๋ฃจํ์ ๋น ์ง๊ธฐ ์ฝ๋ค..

1. Anonymous5/9/11 23:26

๋ฏผํ๊ท
#include
int fi(int n);

void main()
{
printf("%d\n",fi(11));
}

int fi(int n)
{

int a=0;
int b=1;
if(n>2)
{
a=fi(n-2);
b=fi(n-1);
}
return a+b;

}

2. Anonymous6/9/11 00:41

JeKang's Code :

#include

int fiv(int Num);

int main()
{
int Num=0;
scanf("%d", &Num);
printf("%d",fiv(Num));
}

int fiv(int Num)
{
if(Num==0) return 0;
else if(Num==1) return 1;
else if(Num>1){
}
}

3. Anonymous6/9/11 00:44

์์  ๋ฏผํ๊ท
#include

int fi(int n);

void main()
{
int n;
printf("ํผ๋ณด๋์น์์ดfi(n):");
scanf("%d",&n);
printf("%d\n",fi(n));
}

int fi(int n)
{

int a=0;
int b=1;
if(n>=2)
{
a=fi(n-2);
b=fi(n-1);
return a+b;
}
else if(n==0) return a;
else if(n==1) return b;

}

4. #include

int RecursiveF(int n);

void main()
{

int x=20;
for(int i=0; i<x; ++i)
{
printf("f(%d) = %d\n", i, RecursiveF(i) );
}
}

int RecursiveF(int n)
{
if(n==0)
return 0;

if(n==1)
return 1;

return (RecursiveF(n-2) + RecursiveF(n-1));
}

5. ๋ค๋ค ์ํ๋ค.
์ด๋? ๋ฐ๋ณต์  ๋ฐฉ๋ฒ๊ณผ ์ฌ๊ทํธ์ถ์  ๋ฐฉ๋ฒ์ค ์ด๋ค๊ฒ ํ๋ก๊ทธ๋จ ํ๊ธฐ ํธํ๊ฒ ๊ฐ์?(์๊ธฐ ์๊ฐ ์ฝ๋ฉํธ ํ๋์ฉ ๋ฌ๊ธฐ~)
...
ํ์ง๋ง ์ฌ๊ทํธ์ถ ๋ฐฉ๋ฒ์ ๋ฐ๋ณต์ ์ธ ๋ฐ๋ณต๋ณด๋ค ํ๋ก๊ทธ๋จ์ ๋ถ๋ด์ ๋ง์ด ์ฃผ๋ ๋ฐฉ๋ฒ์ด์ผ.. ์๋ํ๋ฉด ํจ์์์ ํจ์๋ฅผ ํธ์ถ.. ๋ ๋ค์ ํจ์ ํธ์ถ.. ์ด๋ ๊ฒ ์์ผ๋ก ๋ค์ด๊ฐ์๋ก ํ๋ก๊ทธ๋จ์ ๊ธฐ์ตํ ๊ฒ ๋ง์์ง๊ฑฐ๋ .
ํจ์๋ฅผ ๋ง์ณค์๋ ๋์๊ฐ์ผํ๋ ์์น ๊ทธ๋ฆฌ๊ณ  ๊ณ์ ์์ฑ๋๋ ์ง์ญ ๋ณ์๋ค(ํธ์ถ๋ ํจ์๊ฐ ๋๋๊ธฐ์ ๊น์ง ํจ์์์ ๋ณ์๋ค์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฐจ์งํจ)..
๊ทธ๋์ ๋๋๋ก ์ฌ๊ทํจ์๋ ์์ฐ๋๊ฒ ์ข์ง๋ง ์ปดํจํฐ ์ฑ๋ฅ์ ๋ฌด๋ฆฌ๋ฅผ ์์ค๋ค๋ฉด ์๊ณ ๋ฆฌ์ฆ์ ๊น๋ํ๊ฒ ์์ฑ์ํฌ์ ์์ง..
๊ทธ๋ฆฌ๊ณ  ์ฌ๊ทํธ์ถ์ ์๊ณ ๋ฆฌ์ฆ ๊ณต๋ถํ ๋ ๋ผ๋ฆฌ์  ์ฌ๊ณ ๋ฅผ ํค์ฐ๊ธฐ ์ํด ์ข์ ๋ฐฉ๋ฒ์ธ๊ฒ ๊ฐ๋ค..

๊ทธ๋ผ ๋ฟ~

6. Anonymous7/9/11 03:28

์ฌ๊ทํธ์ถ ๋ฐฉ๋ฒ์ ์ด๋ฒ์ ์ฒ์ ํ๋ก๊ทธ๋๋ฐ ํด๋ด์ ๊ทธ๋ฐ์ง ๋ชจ๋ฅด๊ฒ ๋๋ฐ ๋ฐ๋ณต๋ฌธ์ด ํจ์ฌ ํธํ๊ฑฐ ๊ฐ์์. ์์ ํ๋์ด ์ ์ด๋์ ๊ฑฐ ์ฒ๋ผ ํจ์์์ ํจ์์์ ํจ์... ๊ณ์ ํธ์ถํ๊ธฐ ๋๋ฌธ์ ํธ์ถ ์์น์ ๋ฐ๋ผ ๊ฒฐ๊ณผ๋ฅผ ์์ํ๊ธฐ๊ฐ ๋๋ฌด ํ๋ค์์ด์.

๋ผ๋ฆฌ์  ์ฌ๊ณ ๋ฅผ ํค์ฐ๋๋ฐ๋ ์ข์ ๋ฐฉ๋ฒ์ธ๊ฑฐ ๊ฐ์๋ฐ, ์ฅ์ ๋ณด๋ค๋ ๋จ์ ์ด ๋ง์์ ์์ง ์ด๋ณด์ธ ์ ๋ ๋ฐ๋ณต๋ฌธ์ผ๋ก ๋ง๋๋๊ฒ ์ข์๊ฑฐ ๊ฐ์์.ใใ