<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Encrypt3d</title>
	<atom:link href="http://encrypt3d.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://encrypt3d.wordpress.com</link>
	<description>you have to just decrypt it !</description>
	<lastBuildDate>Mon, 06 Aug 2007 18:58:33 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='encrypt3d.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/f5b8dfed19b7b9454581d46b581559b1?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Encrypt3d</title>
		<link>http://encrypt3d.wordpress.com</link>
	</image>
			<item>
		<title>Floyd Warshall Algorithm!</title>
		<link>http://encrypt3d.wordpress.com/2007/08/06/floyd-warshall-algorithm/</link>
		<comments>http://encrypt3d.wordpress.com/2007/08/06/floyd-warshall-algorithm/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 17:52:52 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/08/06/floyd-warshall-algorithm/</guid>
		<description><![CDATA[The Floyd-Warshall Algorithm is an efficient algorithm to find all-pairs shortest paths on a graph. That is, it is guaranteed to find the shortest path between every pair of vertices in a graph. The graph may have negative weight edges, but no negative weight cycles (for then the shortest path is undefined).
This algorithm can also [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=77&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The <a href="http://www.algorithmist.com/index.php/Floyd-Warshall's_Algorithm" target="_blank"><strong>Floyd-Warshall Algorithm</strong></a> is an efficient algorithm to find all-pairs shortest paths on a graph. That is, it is guaranteed to find the shortest path between every pair of vertices in a graph. The graph may have negative weight edges, but no negative weight cycles (for then the shortest path is undefined).</p>
<p>This algorithm can also be used to detect the presence of negative cycles—the graph has one if at the end of the algorithm, the distance from a vertex <span class="texhtml"><em>v</em></span> to itself is negative.</p>
<p>The problems form ACM UVA , <a href="http://online-judge.uva.es/p/v5/523.html">523</a> and <a href="http://online-judge.uva.es/p/v6/627.html" target="_blank">627</a></p>
<p>Assuming that a[i][j]=-1 where there is no path. p[i][j] is used for tracing the  shortest path. The Algorithm is just an application of Dynamic Programming. INF is considered to be a very big integer.</p>
<p><code>for(int i=0;i&lt;n;++i)<br />
for(int j=0;j&lt;n;j++)<br />
if (a[i][j]==-1)<br />
{<br />
a[i][j]=INF;<br />
}<br />
for(int i=0;i&lt;n;i++)<br />
for(int j=0;j&lt;n;j++)<br />
p[i][j]=i;<br />
for(int k=0;k&lt;n;k++)<br />
{<br />
for(int i=0;i&lt;n;i++)<br />
{<br />
for(int j=0;j&lt;n;j++)<br />
{<br />
if(a[i][j] &gt; a[i][k]+a[k][j])<br />
{  a[i][j]=a[i][k]+a[k][j];<br />
p[i][j]=p[k][j];<br />
}<br />
}<br />
}<br />
}</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/77/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/77/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=77&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/08/06/floyd-warshall-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>
	</item>
		<item>
		<title>Longest path!</title>
		<link>http://encrypt3d.wordpress.com/2007/08/05/longest-path/</link>
		<comments>http://encrypt3d.wordpress.com/2007/08/05/longest-path/#comments</comments>
		<pubDate>Sun, 05 Aug 2007 20:28:31 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Acm]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/08/05/longest-path/</guid>
		<description><![CDATA[The problem taken form acm uva site , Longest Path 
Since we need to know the longest path for a source node given, the graph of cities to be traversed in DFS. The Depth First Traversal visits all nodes reachable from the source node.  Here is the function needed for DFS in this problem.
void [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=74&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The problem taken form acm uva site ,<a href="http://acm.uva.es/p/v100/10000.html" target="_blank"> Longest Path </a></p>
<p>Since we need to know the longest path for a source node given, the graph of cities to be traversed in DFS. The Depth First Traversal visits all nodes reachable from the source node.  Here is the function needed for DFS in this problem.</p>
<p><code>void dfs(long snode)<br />
{<br />
long i;<br />
if(sum&gt;max)<br />
{<br />
max=sum;<br />
p=snode;<br />
}<br />
for(i=0;i&lt;num;i++)<br />
{<br />
if(n[snode][i]==1&amp;&amp;visited[snode][i]==0&amp;&amp;i!=start)<br />
{<br />
visited[snode][i]=1;<br />
sum++;<br />
dfs(i);<br />
sum--;<br />
visited[snode][i]=0;<br />
}<br />
}<br />
}</code></p>
<p><a href="http://encrypt3d.files.wordpress.com/2007/08/dfs.png" title="dfs.png"><img src="http://encrypt3d.files.wordpress.com/2007/08/dfs.png" alt="dfs.png" /></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/74/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/74/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=74&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/08/05/longest-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>

		<media:content url="http://encrypt3d.files.wordpress.com/2007/08/dfs.png" medium="image">
			<media:title type="html">dfs.png</media:title>
		</media:content>
	</item>
		<item>
		<title>Threaded binary Trees !!</title>
		<link>http://encrypt3d.wordpress.com/2007/08/05/threaded-binary-trees/</link>
		<comments>http://encrypt3d.wordpress.com/2007/08/05/threaded-binary-trees/#comments</comments>
		<pubDate>Sun, 05 Aug 2007 08:27:39 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Data Structures]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/08/05/threaded-binary-trees/</guid>
		<description><![CDATA[Traversing the binary tree is the most important operation and used in almost every application. The iterative implementation of traversing the binary tree is implemented using either stack (simulation of recursion) or using the threaded binary trees , later being the more efficient. The idea is to maintain extra information of a particular traversal which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=73&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Traversing the binary tree is the most important operation and used in almost every application. The iterative implementation of traversing the binary tree is implemented using either stack (simulation of recursion) or using the threaded binary trees , later being the more efficient. The idea is to maintain extra information of a particular traversal which saves a lot of pushing and popping in stack implementation. This is done by maintaining extra pointer to the leaf nodes (right child in case of right-in threaded binary tree, named on the basis of same) known as thread . This is done as follows:</p>
<p>While adding a left child in right-in threaded binary tree</p>
<p>- Point the right child of the node to its parent.</p>
<p>While adding a right child in right -in threaded binary tree</p>
<p>-Point the right child of the node to the thread of the parent</p>
<p>The thread is detected from the normal links by using a boolean field in the node , when set to true indicates that  it is actually a thread .</p>
<p>Here is the implementation<br />
<code>struct tnode *insert(struct tnode *p , int val)<br />
{<br />
if(p==NULL)<br />
{<br />
p = (struct tnode *)malloc(sizeof(struct tnode));<br />
p-&gt;data = val;<br />
p-&gt;left = NULL;<br />
p-&gt;right = NULL;<br />
p-&gt;rthread=true;<br />
}<br />
else<br />
{<br />
struct tnode *q,*temp;<br />
q=p;<br />
temp=p;<br />
while(q != NULL &amp;&amp; q-&gt;rthread==false)<br />
{<br />
temp= q;<br />
if( val &gt;= temp-&gt;data )<br />
q=temp-&gt;right;<br />
else if( val &lt; temp-&gt;data )<br />
q=temp-&gt;left;<br />
}<br />
struct tnode *n;<br />
n= (struct tnode *)malloc (sizeof(struct tnode));<br />
n-&gt;data =val;<br />
if( val &gt;=temp-&gt;data  )<br />
{<br />
if(temp-&gt;rthread)<br />
{<br />
struct tnode *r;<br />
r=temp-&gt;right;<br />
temp-&gt;right =n;<br />
temp-&gt;rthread=false;<br />
n-&gt;left=NULL;<br />
n-&gt;right=r;<br />
n-&gt;rthread=true;<br />
}<br />
}<br />
else<br />
{<br />
temp-&gt;left = n;<br />
n-&gt;left=NULL;<br />
n-&gt;right=temp;<br />
n-&gt;rthread=true;<br />
}<br />
}<br />
return p;<br />
}</code></p>
<p>A left-in-threaded binary tree  may be defined similarly, as one in which each NULL left pointer  is altered to contain a thread to that node&#8217;s inorder predecessor. <strong>An in-threaded binary tree may then be defined as a binary tree that is  both left in-threaded and right in-threaded. </strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/73/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/73/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=73&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/08/05/threaded-binary-trees/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>
	</item>
		<item>
		<title>Kopete and Latex</title>
		<link>http://encrypt3d.wordpress.com/2007/08/04/kopete-and-latex/</link>
		<comments>http://encrypt3d.wordpress.com/2007/08/04/kopete-and-latex/#comments</comments>
		<pubDate>Sat, 04 Aug 2007 20:21:52 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/08/04/kopete-and-latex/</guid>
		<description><![CDATA[Latex has been the best typesetting software ever made.  I have always preferred it for any type of document. Latex has been very useful in case you want to use many mathematical formulas in the document. Sometimes, though rarely  , we need to use mathematical expressions in our chat conversation. I was wondering [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=67&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.latex-project.org/" target="_blank">Latex</a> has been the best typesetting software ever made.  I have always preferred it for any type of document. Latex has been very useful in case you want to use many mathematical formulas in the document. Sometimes, though rarely <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> , we need to use mathematical expressions in our chat conversation. I was wondering if any messenger provides the \Latex support in the chat window. Then I found kopete&#8217;s &#8221; KopeTeX&#8221; plugin allows Kopete to render Latex \<br />
formulas in the chat window. The sender must enclose the formula between two $ signs. \<br />
ie: $$formula$$ +This plugin requires ImageMagick convert program installed in order.</p>
<p>For example: for T= 2 PI /OMEGA</p>
<p><code>$$T=2\frac{\pi}{\omega}$$</code></p>
<pre></pre>
<p><a href="http://encrypt3d.files.wordpress.com/2007/08/kopete.jpg" title="Direct link to file"><br />
</a></p>
<p><a href="http://encrypt3d.files.wordpress.com/2007/08/kopete3.jpg" title="kopete3.jpg"><img src="http://encrypt3d.files.wordpress.com/2007/08/kopete3.jpg" alt="kopete3.jpg" /></a></p>
<p><a href="http://encrypt3d.files.wordpress.com/2007/08/kopete11.jpg" title="kopete11.jpg"><img src="http://encrypt3d.files.wordpress.com/2007/08/kopete11.jpg" alt="kopete11.jpg" /></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/67/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/67/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=67&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/08/04/kopete-and-latex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>

		<media:content url="http://encrypt3d.files.wordpress.com/2007/08/kopete3.jpg" medium="image">
			<media:title type="html">kopete3.jpg</media:title>
		</media:content>

		<media:content url="http://encrypt3d.files.wordpress.com/2007/08/kopete11.jpg" medium="image">
			<media:title type="html">kopete11.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Merging two sorted linked lists !!</title>
		<link>http://encrypt3d.wordpress.com/2007/08/04/merging-two-sorted-linked-lists/</link>
		<comments>http://encrypt3d.wordpress.com/2007/08/04/merging-two-sorted-linked-lists/#comments</comments>
		<pubDate>Sat, 04 Aug 2007 13:02:25 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Data Structures]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/08/04/merging-two-sorted-linked-lists/</guid>
		<description><![CDATA[The problem is just like merging step in merge sort, wherein we have two sorted arrays and merge them into one. The algorithm is simple and stated as:
struct node *merge(struct node *p,struct node *q)
{
struct node *r,*s;
struct node *a=NULL;
r=p; s=q;
while(r !=NULL &#38;&#38; s!= NULL)
{
if(r-&#62;data &#60;= s-&#62;data)
{
a=insert(a,r-&#62;data);
r=r-&#62;link;
}
else{
a=insert(a,s-&#62;data);
s=s-&#62;link;
}
}
if(r==NULL)
while(s!=NULL)
{
a=insert(a,s-&#62;data);
s=s-&#62;link;
}
else
while(r!=NULL)
{
a=insert(a,r-&#62;data);
r=r-&#62;link;
}
return a;
}
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=65&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The problem is just like merging step in merge sort, wherein we have two sorted arrays and merge them into one. The algorithm is simple and stated as:<br />
<code>struct node *merge(struct node *p,struct node *q)<br />
{<br />
struct node *r,*s;<br />
struct node *a=NULL;<br />
r=p; s=q;<br />
while(r !=NULL &amp;&amp; s!= NULL)<br />
{<br />
if(r-&gt;data &lt;= s-&gt;data)<br />
{<br />
a=insert(a,r-&gt;data);<br />
r=r-&gt;link;<br />
}<br />
else{<br />
a=insert(a,s-&gt;data);<br />
s=s-&gt;link;<br />
}<br />
}<br />
if(r==NULL)<br />
while(s!=NULL)<br />
{<br />
a=insert(a,s-&gt;data);<br />
s=s-&gt;link;<br />
}<br />
else<br />
while(r!=NULL)<br />
{<br />
a=insert(a,r-&gt;data);<br />
r=r-&gt;link;<br />
}<br />
return a;<br />
}</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/65/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/65/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=65&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/08/04/merging-two-sorted-linked-lists/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>
	</item>
		<item>
		<title>all about binary tree !!</title>
		<link>http://encrypt3d.wordpress.com/2007/08/01/all-about-binary-tree/</link>
		<comments>http://encrypt3d.wordpress.com/2007/08/01/all-about-binary-tree/#comments</comments>
		<pubDate>Wed, 01 Aug 2007 20:06:41 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Data Structures]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/08/01/all-about-binary-tree/</guid>
		<description><![CDATA[I recently implemented few of the operations on the binary tree. Some of the operations might match with my previous posts.  I have simply posted the code. Please come up with  queries if any.
#include&#60;iostream&#62;
#include&#60;stdio.h&#62;
#include&#60;algorithm&#62;
#include&#60;cmath&#62;
long long  test;
using namespace std;
struct tnode {
int data;
struct tnode *left;
struct tnode *right;
};
int flag=0;
struct tnode *insert(struct tnode *p , int [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=64&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I recently implemented few of the operations on the binary tree. Some of the operations might match with my previous posts.  I have simply posted the code. Please come up with  queries if any.</p>
<p><code>#include&lt;iostream&gt;<br />
#include&lt;stdio.h&gt;<br />
#include&lt;algorithm&gt;<br />
#include&lt;cmath&gt;<br />
long long  test;<br />
using namespace std;<br />
struct tnode {<br />
int data;<br />
struct tnode *left;<br />
struct tnode *right;<br />
};<br />
int flag=0;<br />
struct tnode *insert(struct tnode *p , int val)<br />
{<br />
if(p==NULL)<br />
{ p = (struct tnode *)malloc(sizeof(struct tnode));<br />
p-&gt;data = val;<br />
p-&gt;left = NULL;<br />
p-&gt;right = NULL;<br />
}<br />
else<br />
{<br />
struct tnode *q,*temp;<br />
q=p;<br />
temp=p;<br />
while(q != NULL  )<br />
{<br />
temp= q;<br />
if( val &gt;= temp-&gt;data)<br />
q=temp-&gt;right;<br />
else<br />
q=temp-&gt;left;<br />
}<br />
struct tnode *n;<br />
n= (struct tnode *)malloc (sizeof(struct tnode));<br />
n-&gt;data =val;<br />
if( val &gt;=temp-&gt;data )<br />
temp-&gt;right =n;<br />
else<br />
temp-&gt;left = n;<br />
}<br />
return p;<br />
}<br />
int count1 ( struct tnode *p)<br />
{ int c1=0;<br />
int c2=0;<br />
if( p != NULL){<br />
c1=count1(p-&gt;left);<br />
c2= count1(p-&gt;right);<br />
return 1+c1+c2;<br />
}<br />
}<br />
struct tnode *delmin(struct tnode *p)<br />
{<br />
struct tnode *temp=p;<br />
while( temp-&gt;left-&gt;left != NULL)<br />
{<br />
temp = temp-&gt;left;<br />
}<br />
temp-&gt;left=NULL;<br />
delete(temp-&gt;left);<br />
return p;<br />
}<br />
struct tnode *delmax(struct tnode *p)<br />
{<br />
struct tnode *temp=p;<br />
while( temp-&gt;right-&gt;right != NULL)<br />
{<br />
temp = temp-&gt;right;<br />
}<br />
temp-&gt;right=NULL;<br />
delete(temp-&gt;right);<br />
return p;<br />
}<br />
int height(struct tnode *p)<br />
{<br />
int h1=0;<br />
int h2=0;<br />
if (p == NULL)<br />
return 0;<br />
if(p-&gt;left)<br />
h1= height(p-&gt;left);<br />
if(p-&gt;right)<br />
h2= height(p-&gt;right);<br />
return (1+max(h1,h2));<br />
}<br />
bool iscomptree(struct tnode *p)<br />
{<br />
struct tnode *temp=p;<br />
int l,h;<br />
l=count1(p);<br />
h=height(temp);<br />
int t;<br />
t=(int) (pow(2,((float)h))-1);<br />
if(t == l)<br />
return true;<br />
else<br />
return false;<br />
}<br />
struct tnode *mirror(struct tnode *p)<br />
{<br />
if(p == NULL)<br />
return p ;<br />
else<br />
{<br />
mirror(p-&gt;left);<br />
mirror(p-&gt;right);<br />
struct    tnode *temp;<br />
temp=p-&gt;left;<br />
p-&gt;left=p-&gt;right;<br />
p-&gt;right=temp;<br />
}<br />
return p;<br />
}<br />
bool identical(struct tnode* a, struct tnode* b)<br />
{<br />
if (a==NULL &amp;&amp; b==NULL){return(true);}<br />
else if (a!=NULL &amp;&amp; b!=NULL)<br />
{<br />
return(a-&gt;data == b-&gt;data &amp;&amp;<br />
identical(a-&gt;left, b-&gt;left) &amp;&amp;<br />
identical(a-&gt;right, b-&gt;right));<br />
}<br />
else return(false);<br />
}<br />
int check( struct tnode *p)<br />
{ int h1,h2,sum=0;<br />
if(p != NULL)<br />
{<br />
if(p-&gt;left  &amp;&amp; ! (p-&gt;right) || p-&gt;right &amp;&amp; !(p-&gt;left))<br />
{<br />
flag=1;<br />
return flag;<br />
}<br />
else{<br />
if(flag != 1)<br />
{<br />
flag= check(p-&gt;left);<br />
flag=check(p-&gt;right);<br />
}<br />
}<br />
}<br />
return flag;<br />
}<br />
int add ( struct tnode *p)<br />
{  int sum1=0, sum2=0 ;<br />
if( p != NULL){<br />
sum1=add(p-&gt;left);<br />
sum2=add(p-&gt;right);<br />
return sum1+sum2+p-&gt;data;<br />
}<br />
}<br />
void inorder ( struct tnode *p)<br />
{<br />
if( p != NULL){<br />
inorder(p-&gt;left);<br />
printf("%d\t",p-&gt;data);<br />
inorder(p-&gt;right);<br />
}<br />
}<br />
void preorder ( struct tnode *p)<br />
{<br />
if( p != NULL){<br />
printf("%d\t",p-&gt;data);<br />
preorder(p-&gt;left);<br />
preorder(p-&gt;right);<br />
}<br />
}<br />
void postorder ( struct tnode *p)<br />
{<br />
if( p != NULL){<br />
postorder(p-&gt;left);<br />
postorder(p-&gt;right);<br />
printf("%d\t",p-&gt;data);<br />
}<br />
}<br />
main()<br />
{<br />
struct tnode *root=NULL;<br />
root=insert(root,16);<br />
root=insert(root,14);<br />
root=insert(root,20);<br />
root=insert(root,12);<br />
root=insert(root,15);<br />
root=insert(root,18);<br />
root=insert(root,22);<br />
printf("Inorder traversal of the tree\n");<br />
inorder(root);<br />
cout&lt;&lt;endl;<br />
printf("Preorder traversal of the tree\n");<br />
preorder(root);<br />
cout&lt;&lt;endl;<br />
printf("Postorder traversal of the tree\n");<br />
postorder(root);<br />
cout&lt;&lt;endl;<br />
printf("Height of the binary tree : ");<br />
cout&lt;&lt;height(root)-1;<br />
cout&lt;&lt;endl;<br />
printf("Strictly binary tree[=0]: ");<br />
cout&lt;&lt;check(root);<br />
cout&lt;&lt;endl;<br />
printf("Complete binary tree[=1]: ");<br />
cout&lt;&lt;iscomptree(root);<br />
cout&lt;&lt;endl;<br />
struct tnode *r;<br />
cout&lt;&lt;endl;<br />
root=delmin(root);<br />
inorder(root);<br />
root=delmax(root);<br />
cout&lt;&lt;endl;<br />
inorder(root);<br />
}</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/64/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/64/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=64&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/08/01/all-about-binary-tree/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>
	</item>
		<item>
		<title>Pirates !</title>
		<link>http://encrypt3d.wordpress.com/2007/06/23/63/</link>
		<comments>http://encrypt3d.wordpress.com/2007/06/23/63/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 22:12:24 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Puzzle]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/06/23/63/</guid>
		<description><![CDATA[Five pirates have 100 gold coins.They have to divide up the
loot.In order of seniority,each pirate proposes a distribution
of the loot.All the pirates vote,and if at least half accept the
proposal,the loot is divided as proposed.If not,the most senior
pirate is eliminated,and they start over again with the next
senior pirate.What solution does the most senior pirate
propose? Assume they [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=63&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Five pirates have 100 gold coins.They have to divide up the<br />
loot.In order of seniority,each pirate proposes a distribution<br />
of the loot.All the pirates vote,and if at least half accept the<br />
proposal,the loot is divided as proposed.If not,the most senior<br />
pirate is eliminated,and they start over again with the next<br />
senior pirate.What solution does the most senior pirate<br />
propose? Assume they are very intelligent,extremely greedy,<br />
and interested in surviving.</p>
<p><a href="http://encrypt3d.files.wordpress.com/2007/06/09.png" title="09.png"><img src="http://encrypt3d.files.wordpress.com/2007/06/09.png" alt="09.png" /></a></p>
<p>Solution:</p>
<p>The most senior pirate knows that he needs to get two other pirates<br />
to vote for his solution in order for him not to be eliminated. So why<br />
would any pirate vote for him? The next most senior pirate would<br />
surely see it in his self-interest for the senior pirate to be eliminated.<br />
Letís start simplifying. If there were only one pirate, there would<br />
be no puzzle. The pirate would take all the loot, and no one<br />
would complain.<br />
Now consider the situation with two pirates. Same outcome. The<br />
senior pirate takes all the loot, and the other pirate can&#8217;t do a thing<br />
about it as the senior pirate&#8217;s vote represents half of the voters.<br />
It gets more complicated for the senior pirate when there are<br />
three pirates. Let&#8217;s number the pirates from least to most senior:<br />
1, 2, and 3. With three pirates, pirate 3 has to convince at least one<br />
other pirate to join his collation. Pirate 3 realizes that if his plan<br />
is not adopted, he will be eliminated, and they will be left with two<br />
pirates. All of them know what happens when there are two pirates:<br />
pirate 2 takes all the loot himself and pirate 1 gets nothing. So pirate<br />
3 proposes that he will take 99 gold coins and give 1 coin to pirate<br />
1. If pirate 1 has any self-interest at all, he really has no choice. If<br />
pirate 1 rejects the offer, he gets nothing. So pirate 3ís plan will<br />
pass two to one over pirate 2ís objection.<br />
With four pirates, an even number, the senior pirate needs just one<br />
vote other than his own to impose his will. His question now is which<br />
one of the other pirate&#8217;s votes can be exchanged for the fewest number<br />
of coins. Pirate 2 recognizes that he is most vulnerable. Therefore, pirate<br />
4 knows that if he gives pirate 2 anything at all, he will vote for it.<br />
A rule is emerging here. In each case, the senor pirate should buy<br />
only the votes he needs, and buy them as cheaply as possible. Apply<br />
the rule to the five-pirate case. Pirate 5 needs two votes plus his own.<br />
The goal is to toss a coin or two to pirate 1 and pirate 3, the two<br />
pirates in the most vulnerable positions. Both will be empty-handed .</p>
<p>if the senior pirate is eliminated and four pirates remain. So pirate<br />
5 offers one coin to pirate 3 and one coin to pirate 1. Pirates 2 and<br />
4 get nothing.</p>
<p>Click<a href="http://www.techinterview.org/Solutions/fog0000000102.html"> here</a> for detailed solution.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/63/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/63/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=63&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/06/23/63/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>

		<media:content url="http://encrypt3d.files.wordpress.com/2007/06/09.png" medium="image">
			<media:title type="html">09.png</media:title>
		</media:content>
	</item>
		<item>
		<title>Why nine minutes?</title>
		<link>http://encrypt3d.wordpress.com/2007/06/23/why-nine-minutes/</link>
		<comments>http://encrypt3d.wordpress.com/2007/06/23/why-nine-minutes/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 21:51:04 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Puzzle]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/06/23/why-nine-minutes/</guid>
		<description><![CDATA[Many consumer alarm clocks have a snooze button that is
calibrated for 9 minutes.Does that sound like an odd
decision? Many people would think a 10-minute snooze
interval would make more sense.So were the designers asleep?
Why 9 minutes?

By setting the snooze time to 9 minutes, the alarm clock only needs to
watch the last digit of the time. Whether [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=60&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Many consumer alarm clocks have a snooze button that is<br />
calibrated for 9 minutes.Does that sound like an odd<br />
decision? Many people would think a 10-minute snooze<br />
interval would make more sense.So were the designers asleep?<br />
Why 9 minutes?</p>
<p><a href="http://encrypt3d.files.wordpress.com/2007/06/991126.gif" title="991126.gif"><img src="http://encrypt3d.files.wordpress.com/2007/06/991126.gif" alt="991126.gif" /></a></p>
<p>By setting the snooze time to 9 minutes, the alarm clock only needs to<br />
watch the last digit of the time. Whether implemented by physical circuitry<br />
or software, it is easier to manipulate just the terminal digit.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/60/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/60/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=60&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/06/23/why-nine-minutes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>

		<media:content url="http://encrypt3d.files.wordpress.com/2007/06/991126.gif" medium="image">
			<media:title type="html">991126.gif</media:title>
		</media:content>
	</item>
		<item>
		<title>putchar to int!</title>
		<link>http://encrypt3d.wordpress.com/2007/06/22/putchar-to-int/</link>
		<comments>http://encrypt3d.wordpress.com/2007/06/22/putchar-to-int/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 20:10:55 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Simple Ones!!]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/06/22/putchar-to-int/</guid>
		<description><![CDATA[ Print an integer using only putchar. Try doing it without using extra storage.		 		  
void print_to_int(int x)
{
if(x &#60;=9)
{putchar(x+'0');
return;
}
else
print_to_int(x/10);putchar(x%10+'0');
}
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=59&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Print an integer using only putchar. Try doing it without using extra storage.		 		  </font></font></p>
<p><code>void print_to_int(int x)<br />
{<br />
if(x &lt;=9)<br />
{putchar(x+'0');<br />
return;<br />
}<br />
else<br />
print_to_int(x/10);putchar(x%10+'0');<br />
}</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/59/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/59/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=59&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/06/22/putchar-to-int/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>
	</item>
		<item>
		<title>Level order traversal!</title>
		<link>http://encrypt3d.wordpress.com/2007/06/19/level-order-traversal/</link>
		<comments>http://encrypt3d.wordpress.com/2007/06/19/level-order-traversal/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 21:17:16 +0000</pubDate>
		<dc:creator>encrypt3d</dc:creator>
				<category><![CDATA[Data Structures]]></category>

		<guid isPermaLink="false">http://encrypt3d.wordpress.com/2007/06/19/level-order-traversal/</guid>
		<description><![CDATA[For the level order of the binary tree:
1- start from the root, display it
2-put the left child and then right child in a queue
3-again consider the first element of the queue as root and repeat the procedure till the whole tree is traversed.
here is the C code :
void levelorder(struct tnode *p)
{
struct tnode *queue[100]={(struct tnode*) 0};
int [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=57&subd=encrypt3d&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For the level order of the binary tree:</p>
<p>1- start from the root, display it</p>
<p>2-put the left child and then right child in a queue</p>
<p>3-again consider the first element of the queue as root and repeat the procedure till the whole tree is traversed.</p>
<p>here is the C code :</p>
<p><code>void levelorder(struct tnode *p)<br />
{<br />
struct tnode *queue[100]={(struct tnode*) 0};<br />
int size=0;<br />
int qptr=0;<br />
while(p)<br />
{<br />
printf("%d\t",p-&gt;data);<br />
if(p-&gt;left)<br />
{<br />
queue[size++]=p-&gt;left;<br />
}<br />
if(p-&gt;right)<br />
{<br />
queue[size++]=p-&gt;right;<br />
}<br />
p=queue[qptr++];<br />
}<br />
}</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/encrypt3d.wordpress.com/57/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/encrypt3d.wordpress.com/57/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/encrypt3d.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/encrypt3d.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/encrypt3d.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/encrypt3d.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/encrypt3d.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/encrypt3d.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/encrypt3d.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/encrypt3d.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/encrypt3d.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/encrypt3d.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=encrypt3d.wordpress.com&blog=1190852&post=57&subd=encrypt3d&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://encrypt3d.wordpress.com/2007/06/19/level-order-traversal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a0fb451a98b894136fa69b2239c2b20?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">encrypt3d</media:title>
		</media:content>
	</item>
	</channel>
</rss>