<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: CSci 101 Part II</title>
	<atom:link href="http://benreichelt.net/blog/2005/01/20/csci-101-part-ii/feed/" rel="self" type="application/rss+xml" />
	<link>http://benreichelt.net/blog/2005/01/20/csci-101-part-ii/</link>
	<description></description>
	<lastBuildDate>Tue, 18 Aug 2009 22:20:45 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anonymous</title>
		<link>http://benreichelt.net/blog/2005/01/20/csci-101-part-ii/comment-page-1/#comment-170</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 20 Jan 2005 09:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://s194721765.onlinehome.us/blog/2005/01/20/csci-101-part-ii/#comment-170</guid>
		<description>alright, we got some c++ out there, now we&#039;re really getting academic :)  I like the use of the pointers, good stuff!</description>
		<content:encoded><![CDATA[<p>alright, we got some c++ out there, now we&#8217;re really getting academic <img src='http://benreichelt.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   I like the use of the pointers, good stuff!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://benreichelt.net/blog/2005/01/20/csci-101-part-ii/comment-page-1/#comment-169</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 20 Jan 2005 09:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://s194721765.onlinehome.us/blog/2005/01/20/csci-101-part-ii/#comment-169</guid>
		<description>I thought about the array, but decided I&#039;d rather try and use tail calls, so that I wouldn&#039;t have to create a data structure:&lt;br&gt;&lt;br&gt;int fibofact(int ordinal, int* pfactor)&lt;br&gt;{&lt;br&gt;	if (ordinal == 1)&lt;br&gt;	{&lt;br&gt;		*pfactor = 0; return 0;&lt;br&gt;	}&lt;br&gt;	if (ordinal == 2)&lt;br&gt;	{&lt;br&gt;		*pfactor = 0; return 1;&lt;br&gt;	}&lt;br&gt;	int myfactor = 0;&lt;br&gt;	*pfactor = fibofact(ordinal-1, &#38;myfactor);&lt;br&gt;	return *pfactor + myfactor; &lt;br&gt;}&lt;br&gt;int fibo(int ordinal)&lt;br&gt;{&lt;br&gt;	if (ordinal == 1)&lt;br&gt;		return 0;&lt;br&gt;	if (ordinal == 2)&lt;br&gt;		return 1;&lt;br&gt;	int myfactor = 0;&lt;br&gt;	return fibofact(ordinal-1, &#38;myfactor)+myfactor;&lt;br&gt;}</description>
		<content:encoded><![CDATA[<p>I thought about the array, but decided I&#8217;d rather try and use tail calls, so that I wouldn&#8217;t have to create a data structure:</p>
<p>int fibofact(int ordinal, int* pfactor)<br />
<br />{<br />
<br />	if (ordinal == 1)<br />
<br />	{<br />
<br />		*pfactor = 0; return 0;<br />
<br />	}<br />
<br />	if (ordinal == 2)<br />
<br />	{<br />
<br />		*pfactor = 0; return 1;<br />
<br />	}<br />
<br />	int myfactor = 0;<br />
<br />	*pfactor = fibofact(ordinal-1, &#38;#38;myfactor);<br />
<br />	return *pfactor + myfactor;<br />
<br />}<br />
<br />int fibo(int ordinal)<br />
<br />{<br />
<br />	if (ordinal == 1)<br />
<br />		return 0;<br />
<br />	if (ordinal == 2)<br />
<br />		return 1;<br />
<br />	int myfactor = 0;<br />
<br />	return fibofact(ordinal-1, &#38;#38;myfactor)+myfactor;<br />
<br />}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://benreichelt.net/blog/2005/01/20/csci-101-part-ii/comment-page-1/#comment-168</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 20 Jan 2005 06:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://s194721765.onlinehome.us/blog/2005/01/20/csci-101-part-ii/#comment-168</guid>
		<description>Sorry.  I won&#039;t answer next time!  :)</description>
		<content:encoded><![CDATA[<p>Sorry.  I won&#8217;t answer next time!  <img src='http://benreichelt.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://benreichelt.net/blog/2005/01/20/csci-101-part-ii/comment-page-1/#comment-167</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 20 Jan 2005 04:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://s194721765.onlinehome.us/blog/2005/01/20/csci-101-part-ii/#comment-167</guid>
		<description>Darrell, you keep ruining my fun!! ;)  Yes, you&#039;re right on about the array, thanks for reading!</description>
		<content:encoded><![CDATA[<p>Darrell, you keep ruining my fun!! <img src='http://benreichelt.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   Yes, you&#8217;re right on about the array, thanks for reading!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://benreichelt.net/blog/2005/01/20/csci-101-part-ii/comment-page-1/#comment-166</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 20 Jan 2005 03:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://s194721765.onlinehome.us/blog/2005/01/20/csci-101-part-ii/#comment-166</guid>
		<description>The first thing I would try is to make an array of size n when fibo(n) is called.  Then if the value was in the array, return it, else calculate it recursively (which will also do the lookup).&lt;br&gt;&lt;br&gt;That way it should be on the O(n), right?  I always get my big-O notation whacked.  ;)</description>
		<content:encoded><![CDATA[<p>The first thing I would try is to make an array of size n when fibo(n) is called.  Then if the value was in the array, return it, else calculate it recursively (which will also do the lookup).</p>
<p>That way it should be on the O(n), right?  I always get my big-O notation whacked.  <img src='http://benreichelt.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
