<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Turkcekaynak.net &#187; fibonacci</title>
	<atom:link href="http://turkcekaynak.net/tag/fibonacci/feed" rel="self" type="application/rss+xml" />
	<link>http://turkcekaynak.net</link>
	<description>Windows 7, Wordpress, Dmoz, Google, Msn, Programlama, Yazılım, İnternet</description>
	<lastBuildDate>Fri, 21 Oct 2011 20:29:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Recursive Fonksiyonlar</title>
		<link>http://turkcekaynak.net/programlama/cpp/recursive-fonksiyonlar.html</link>
		<comments>http://turkcekaynak.net/programlama/cpp/recursive-fonksiyonlar.html#comments</comments>
		<pubDate>Thu, 02 Jul 2009 12:49:38 +0000</pubDate>
		<dc:creator>nouscomd</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[faktoriyel]]></category>
		<category><![CDATA[fibonacci]]></category>
		<category><![CDATA[fonksiyon]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[recursive]]></category>

		<guid isPermaLink="false">http://turkcekaynak.net/?p=171</guid>
		<description><![CDATA[Recursive fonksiyonlar herhangi bir döngü kullanmadan (for, do while, while..) kendisini çağırarak yazılan fonksiyonlardır. Örneğin; faktoriyel hesaplayan bir fonksiyonu önce normal bir şekilde sonra recursive şekilde yazalim. Şimde de recursive şekilde yazalım.. Başka recursive foksiyon örnekleri Eğer fonksiyon çalıştırılırsa &#8211;> draw(3,7); *** **** ***** ****** ******* &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- Eğer fonksiyon çalıştırılırsa &#8211;> countUnti(2,8); 2 3 4 [...]]]></description>
			<content:encoded><![CDATA[<p style="float: right;margin: 4px;"><script type="text/javascript"><!--
google_ad_client = "pub-7647590832779597";
/* 250x250, oluşturulma 09.04.2010 */
google_ad_slot = "6514548591";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p> <p>Recursive fonksiyonlar herhangi bir döngü kullanmadan (for, do while, while..) kendisini çağırarak yazılan fonksiyonlardır.</p>
<p>Örneğin; faktoriyel hesaplayan bir fonksiyonu önce normal bir şekilde sonra recursive şekilde yazalim.</p>
<pre class="brush: cpp; title: ; notranslate">

int faktoriyel(int n)
{
       int fakt=1;
       for(int i=1; i&lt;=n; i++)
       {
            fakt=fakt*i;
       }
       return fakt;
}
</pre>
<p>Şimde de recursive şekilde yazalım..<span id="more-171"></span></p>
<pre class="brush: cpp; title: ; notranslate">
int faktoriyel(int n)
{
       if (n==1)
            return 1;
       else
            return n*faktoriyel(n-1) ;
}
</pre>
<p><strong><center>Başka recursive foksiyon örnekleri</center></strong></p>
<pre class="brush: cpp; title: ; notranslate">void draw(int count, int limit)
{
      if (count &lt;= limit)
      {
             for(int i = 0 ; i &lt; count ; i++)
                   cout &lt;&lt; &quot;*&quot; ;
             cout &lt;&lt; endl;
             draw(count + 1, limit);
       }
}
</pre>
<p>Eğer fonksiyon çalıştırılırsa &#8211;> draw(3,7);<br />
<strong>***<br />
****<br />
*****<br />
******<br />
*******</strong><br />
<center>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</center></p>
<pre class="brush: cpp; title: ; notranslate">void countUntil(int low, int up)
{
      if (low &lt;= up)
      {
             cout &lt;&lt; low &lt;&lt;&quot; &quot;;
             countUntil(low + 1, up);
       }
}
</pre>
<p>Eğer fonksiyon çalıştırılırsa &#8211;> countUnti(2,8);<br />
<strong>2 3 4 5 6 7 8</strong><br />
<center>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</center><br />
Bir dizideki en büyük elemanı bulan recursive fonksiyonu yazalım.</p>
<pre class="brush: cpp; title: ; notranslate">int enBuyuk(int dizi[],int ilk, int son)
{
      int buyuk;
      if(ilk==son)
             return dizi[ilk];
      else
      {
	     buyuk=enBuyuk(dizi,ilk+1,son);
	     if(dizi[ilk]&gt;=buyuk)
                  return dizi[ilk];
	    else
                  return buyuk;
     }
}
</pre>
<p>Eğer  dizi[5]={5,23,28,7,1} olursa enBuyuk(dizi,0,4);<br />
NOT: 0 ile 4 başlangıç ve son indisler..<br />
<strong>28</strong><br />
<center>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</center><br />
Fibonacci sayisini bulan recursive fonksiyon..</p>
<pre class="brush: cpp; title: ; notranslate">int Fib(int n)
{
      if (n&lt;=1) return n;
      else return Fib(n-1) + Fib(n-2);
}
</pre>
<p>{fn } = 0,1,1,2,3,5,8,13,21,34,55,… (fibonacci serisi)<br />
Eğer fonksiyon çalıştırılırsa &#8211;><br />
<strong>Fib(4); // 3<br />
Fib(5); // 5<br />
Fib(6); // 8</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://turkcekaynak.net/programlama/cpp/recursive-fonksiyonlar.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

