<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Vidya Sagar's Blog</title>
	<atom:link href="http://s4sagar.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://s4sagar.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sun, 16 May 2010 15:13:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='s4sagar.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Vidya Sagar's Blog</title>
		<link>http://s4sagar.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://s4sagar.wordpress.com/osd.xml" title="Vidya Sagar&#039;s Blog" />
	<atom:link rel='hub' href='http://s4sagar.wordpress.com/?pushpress=hub'/>
		<item>
		<title>My Website</title>
		<link>http://s4sagar.wordpress.com/2010/05/16/my-website/</link>
		<comments>http://s4sagar.wordpress.com/2010/05/16/my-website/#comments</comments>
		<pubDate>Sun, 16 May 2010 15:13:40 +0000</pubDate>
		<dc:creator>s4sagar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://s4sagar.wordpress.com/?p=86</guid>
		<description><![CDATA[Guys, Recently I ve hosted my Website. Check it out. http://s4sagar.co.cc<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=86&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Guys,<br />
Recently I ve hosted my Website.</p>
<p>Check it out.<br />
<strong><a href="http://s4sagar.co.cc">http://s4sagar.co.cc</a></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s4sagar.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s4sagar.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/s4sagar.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/s4sagar.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/s4sagar.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/s4sagar.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/s4sagar.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/s4sagar.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/s4sagar.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/s4sagar.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/s4sagar.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/s4sagar.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/s4sagar.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/s4sagar.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=86&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s4sagar.wordpress.com/2010/05/16/my-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24b17021440a7ce1ea58c70cde86e511?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s4sagar</media:title>
		</media:content>
	</item>
		<item>
		<title>My Toolbar For Firefox, Especially for SASTRA Students</title>
		<link>http://s4sagar.wordpress.com/2010/01/19/my-toolbar-for-firefox-especially-for-sastra-students/</link>
		<comments>http://s4sagar.wordpress.com/2010/01/19/my-toolbar-for-firefox-especially-for-sastra-students/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 18:43:10 +0000</pubDate>
		<dc:creator>s4sagar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[own]]></category>
		<category><![CDATA[s4sagar]]></category>
		<category><![CDATA[Sagar]]></category>
		<category><![CDATA[Toolbar]]></category>
		<category><![CDATA[Vidya]]></category>

		<guid isPermaLink="false">http://s4sagar.wordpress.com/2010/01/19/my-toolbar-for-firefox-especially-for-sastra-students/</guid>
		<description><![CDATA[Download the file and Drag and Drop into Firefox. Check it out ! Comments Welcome. After Installing, Dont forget to : &#8220;Heart-Icon -&#62; Share It&#8221; Enjoy. http://kontactr.com/sagar/s4sagar.xpi<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=81&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Download the file and Drag and Drop into Firefox.<br />
Check it out !<br />
Comments Welcome.<br />
After Installing, Dont forget to :<br />
&#8220;Heart-Icon -&gt; Share It&#8221;<br />
Enjoy.</p>
<p>http://kontactr.com/sagar/s4sagar.xpi</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s4sagar.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s4sagar.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/s4sagar.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/s4sagar.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/s4sagar.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/s4sagar.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/s4sagar.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/s4sagar.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/s4sagar.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/s4sagar.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/s4sagar.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/s4sagar.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/s4sagar.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/s4sagar.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=81&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s4sagar.wordpress.com/2010/01/19/my-toolbar-for-firefox-especially-for-sastra-students/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24b17021440a7ce1ea58c70cde86e511?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s4sagar</media:title>
		</media:content>
	</item>
		<item>
		<title>Mozilla Labs Jetpack &#8211; Google It! :: jetpack</title>
		<link>http://s4sagar.wordpress.com/2009/12/20/mozilla-labs-jetpack-google-it-jetpack/</link>
		<comments>http://s4sagar.wordpress.com/2009/12/20/mozilla-labs-jetpack-google-it-jetpack/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 18:05:32 +0000</pubDate>
		<dc:creator>s4sagar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://s4sagar.wordpress.com/?p=79</guid>
		<description><![CDATA[Mozilla Labs Jetpack &#8211; Google It! :: jetpack.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=79&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://jetpackgallery.mozillalabs.com/jetpacks/231">Mozilla Labs Jetpack &#8211; Google It! :: jetpack</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s4sagar.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s4sagar.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/s4sagar.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/s4sagar.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/s4sagar.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/s4sagar.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/s4sagar.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/s4sagar.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/s4sagar.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/s4sagar.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/s4sagar.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/s4sagar.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/s4sagar.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/s4sagar.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=79&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s4sagar.wordpress.com/2009/12/20/mozilla-labs-jetpack-google-it-jetpack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24b17021440a7ce1ea58c70cde86e511?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s4sagar</media:title>
		</media:content>
	</item>
		<item>
		<title>Add-ons for Mozilla Firefox</title>
		<link>http://s4sagar.wordpress.com/2009/12/11/add-ons-for-mozilla-firefox/</link>
		<comments>http://s4sagar.wordpress.com/2009/12/11/add-ons-for-mozilla-firefox/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 23:01:02 +0000</pubDate>
		<dc:creator>s4sagar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://s4sagar.wordpress.com/2009/12/11/add-ons-for-mozilla-firefox/</guid>
		<description><![CDATA[Hi guys , Recently i have written two addons for Mozilla Firefox using the Jetpack utility. You can install them from: http://kontactr.com/sagar/GoogleIt.html http://kontactr.com/sagar/exploreRelated.html Comments Welcome.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=78&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi guys ,<br />
Recently i have written two addons for Mozilla Firefox using the Jetpack utility.<br />
You can install them from:<br />
<a href="http://kontactr.com/sagar/GoogleIt.html">http://kontactr.com/sagar/GoogleIt.html</a><br />
<a href="http://kontactr.com/sagar/exploreRelated.html">http://kontactr.com/sagar/exploreRelated.html</a></p>
<p>Comments Welcome.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s4sagar.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s4sagar.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/s4sagar.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/s4sagar.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/s4sagar.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/s4sagar.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/s4sagar.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/s4sagar.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/s4sagar.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/s4sagar.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/s4sagar.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/s4sagar.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/s4sagar.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/s4sagar.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=78&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s4sagar.wordpress.com/2009/12/11/add-ons-for-mozilla-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24b17021440a7ce1ea58c70cde86e511?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s4sagar</media:title>
		</media:content>
	</item>
		<item>
		<title>About Recursion</title>
		<link>http://s4sagar.wordpress.com/2009/07/30/about-recursion/</link>
		<comments>http://s4sagar.wordpress.com/2009/07/30/about-recursion/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 21:33:44 +0000</pubDate>
		<dc:creator>s4sagar</dc:creator>
				<category><![CDATA[Algorithm Programming]]></category>

		<guid isPermaLink="false">http://s4sagar.wordpress.com/?p=59</guid>
		<description><![CDATA[Recursion is the technique to solve problems by dividing the problem into : 1. A Base Case / Termination Condition. 2. A Sub-Problem / Recursive Call. 3. Combining the results of Sub-Problems to obtain the final result. Wanna Experience Recursion ? Click the following link &#8230; http://s4sagar.wordpress.com/2009/07/30/about-recursion/ Another funny example for recursion , Try googling [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=59&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:12s;"><br />
<strong>Recursion</strong> is the technique to solve problems by dividing the problem into :<br />
<br />
1. A Base Case / Termination Condition.<br />
<br />
2. A Sub-Problem / Recursive Call.<br />
<br />
3. Combining the results of Sub-Problems to obtain the final result.</p>
<p><span style="font-size:12s;"></p>
<p><strong><em>Wanna</em></strong><em> </em><strong><em>Experience Recursion ? Click the following link &#8230;</em></strong><br />
<span style="font-size:12s;"><br />
<strong><a href="http://s4sagar.wordpress.com/2009/07/30/about-recursion/">http://s4sagar.wordpress.com/2009/07/30/about-recursion/</a></strong></p>
<p><span style="font-size:12s;"></p>
<p>Another funny example for recursion ,<br />
<span style="font-size:12s;"><br />
Try googling &#8220;recursion&#8221;<br />
<span style="font-size:12s;"><br />
<a href="http://www.google.co.in/search?hl=en&amp;rlz=1C1CHMI_en-USIN307IN308&amp;ei=6ARySvSgB5zW7AOB7oyrCw&amp;sa=X&amp;oi=spell&amp;resnum=0&amp;ct=result&amp;cd=1&amp;q=recursion&amp;spell=1">http://www.google.co.in/search?hl=en&amp;rlz=1C1CHMI_en-USIN307IN308&amp;ei=6ARySvSgB5zW7AOB7oyrCw&amp;sa=X&amp;oi=spell&amp;resnum=0&amp;ct=result&amp;cd=1&amp;q=recursion&amp;spell=1</a></p>
<p>You will see a &#8220;Did  you mean : recursion&#8221; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
<br />
Try clicking &#8220;recursion&#8221; in &#8220;Did you mean: recursion&#8221; and you will understand what recursion is <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Examples:<br />
<span style="font-size:12s;"><br />
<strong>1. Factorial Problem </strong><br />
<span style="font-size:12s;"><br />
<strong>Problem Statement</strong> :  To evaluate n !<br />
<span style="font-size:12s;"><br />
<strong>Recursive Solution :</strong><br />
<span style="font-size:12s;"></p>
<p>unsigned int fact ( int n )  {</p>
<p>if( n &lt;= 1 ) return 1;</p>
<p>return n * fact ( n -1 ) ;</p>
<p>}<br />
<span style="font-size:12s;"><br />
<strong>Terminating Condition /Base Case :</strong> n &lt;= 1<br />
<span style="font-size:12s;"><br />
<strong>Sub-Problem : </strong>To<strong> </strong>evaluate<strong> </strong>fact( n &#8211; 1 )<br />
<span style="font-size:12s;"><br />
<strong>Final Solution : </strong>n * fact ( n  -  1 )<br />
<span style="font-size:12s;"><br />
You can see that it combines all the subproblems together .<br />
<span style="font-size:12s;"><br />
<strong>Advantages :</strong><br />
<span style="font-size:12s;"><br />
1. Small source code.</p>
<p>2. Easy to code and understand.<br />
<span style="font-size:12s;"><br />
<strong>Disadvantages:</strong><br />
<span style="font-size:12s;"></p>
<p><strong>1.</strong>Take a lot of memory if the recursion depth is high.</p>
<p>For Example, if fact( 500 ) is called,it has to push 499 intermediate results into the System&#8217;s Stack before it can evaluate the result.<br />
<span style="font-size:12s;"><br />
<strong>Simple Optimisation:</strong></p>
<p>unsigned int  fact( int n ) {<br />
<br />
int result = 1 ;</p>
<p>for( int i = 2 ;  i &lt;= n ; ++ i )</p>
<p>result *= i;</p>
<p>return result;</p>
<p>}</p>
<p>You can see that there is no time wasted in the flow of controll between functions and its sub-functions , and storing the intermediate values into the stack. You can thus save the Storing and Fetching time into the stack.<br />
<span style="font-size:12s;"></p>
<p>
Hmm .. Its 3 : 17 A.M already , Guess i ll link you guys to more resources &#8230;</p>
<p>
<span style="font-size:12s;"><br />
<strong>2. Fibonacci Series : </strong></p>
<p><span style="font-size:12s;"><br />
<strong><a href="http://www.cs.northwestern.edu/academics/courses/110/html/fib_rec.html">http://www.cs.northwestern.edu/academics/courses/110/html/fib_rec.html</a></strong><br />
<span style="font-size:12s;"><br />
<strong>3.Towers of Hanoi:</strong></p>
<p><span style="font-size:12s;"><br />
<strong><a href="http://www.cs.cmu.edu/~cburch/survey/recurse/hanoi.html">http://www.cs.cmu.edu/~cburch/survey/recurse/hanoi.html</a></strong><br />
<span style="font-size:12s;"><br />
<strong>You also get the solve the Tower Of Hanoi by urself in the above link <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong><br />
<span style="font-size:12s;"><br />
<strong><em>(Browser should JavaScript 1.2 Enabled)</em></strong><br />
<span style="font-size:12s;"><br />
<strong>4.Eight Queens Problem:</strong></p>
<p><span style="font-size:12s;"><br />
<strong><a href="http://www.animatedrecursion.com/advanced/the_eight_queens_problem.html">http://www.animatedrecursion.com/advanced/the_eight_queens_problem.html</a></strong><br />
<span style="font-size:12s;"></p>
<p><strong>More general n-Queens problem :</strong><br />
<span style="font-size:12s;"><br />
<a href="http://theory.cs.uvic.ca/amof/e_queeI.htm">http://theory.cs.uvic.ca/amof/e_queeI.htm</a><br />
<span style="font-size:12s;"></p>
<p><strong>5. An example TopCoder Problem :</strong><br />
<span style="font-size:12s;"></p>
<table style="empty-cells:show;" border="0">
<tbody>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" colspan="2">
<h3 style="font-family:Arial, Helvetica, Verdana, sans-serif;text-decoration:none;font-weight:bold;font-size:14px;margin:0;padding:0;"><span style="font-weight:normal;">Problem Statement</span></h3>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;"></td>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">There is nothing more beautiful than just an integer number.</p>
<p>You are given an integer n. Write down n in decimal notation with no leading zeroes, and let M be the number of written digits. Perform the following operation exactly ktimes:</p>
<ul style="margin-left:10px;padding-left:10px;">
<li>Choose two different 1-based positions, i and j, such that 1 &lt;= i &lt; j &lt;= M. Swap the digits at positions i and j. This swap must not cause the resulting number to have a leading zero, i.e., if the digit at position j is zero, then i must be strictly greater than 1.</li>
</ul>
<p>Return the maximal possible number you can get at the end of this procedure. If it&#8217;s not possible to perform k operations, return -1 instead.</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" colspan="2"></td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" colspan="2">
<h3 style="font-family:Arial, Helvetica, Verdana, sans-serif;text-decoration:none;font-weight:bold;font-size:14px;margin:0;padding:0;"><span style="font-weight:normal;">Constraints</span></h3>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" align="center" valign="top">-</td>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">n will be between 1 and 1,000,000, inclusive.</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" align="center" valign="top">-</td>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">k will be between 1 and 10, inclusive.</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" colspan="2"></td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" colspan="2">
<h3 style="font-family:Arial, Helvetica, Verdana, sans-serif;text-decoration:none;font-weight:bold;font-size:14px;margin:0;padding:0;"><span style="font-weight:normal;">Examples</span></h3>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" align="center">0)</td>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;"></td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;"></td>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<table style="empty-cells:show;" border="0">
<tbody>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<table style="empty-cells:show;" border="0">
<tbody>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<pre>16375</pre>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<pre>1</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<pre>Returns: 76315</pre>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<table style="empty-cells:show;" border="0">
<tbody>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" colspan="2">The optimal way is to swap 1 and 7.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" align="center">1)</td>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;"></td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;"></td>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<table style="empty-cells:show;" border="0">
<tbody>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<table style="empty-cells:show;" border="0">
<tbody>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<pre>432</pre>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<pre>1</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<pre>Returns: 423</pre>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;">
<table style="empty-cells:show;" border="0">
<tbody>
<tr>
<td style="font-family:Arial, Helvetica, Verdana, sans-serif;color:#ffffff;text-decoration:none;line-height:1.4;font-size:11px;font-weight:normal;" colspan="2">In this case the result is less than the given number.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p><span style="font-size:12s;"></p>
<p>
<strong>More Links:</strong></p>
<p><span style="font-size:12s;"><br />
<strong><a href="http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Recn/">http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Recn/</a></strong><br />
<span style="font-size:12s;"><br />
<strong><a href="http://www.topcoder.com/tc?module=ProblemArchive&amp;sr=&amp;er=&amp;sc=&amp;sd=&amp;class=&amp;cat=Recursion&amp;div1l=&amp;div2l=&amp;mind1s=&amp;mind2s=&amp;maxd1s=&amp;maxd2s=&amp;wr=">http://www.topcoder.com/tc?module=ProblemArchive&amp;sr=&amp;er=&amp;sc=&amp;sd=&amp;class=&amp;cat=Recursion&amp;div1l=&amp;div2l=&amp;mind1s=&amp;mind2s=&amp;maxd1s=&amp;maxd2s=&amp;wr=</a></strong><br />
<span style="font-size:12s;"></p>
<p><span style="font-size:12s;"><br />
- Vidya Sagar S</p>
<p><span style="font-size:12s;"><br />
TopCoder Profile : <a href="http://www.topcoder.com/tc?module=MemberProfile&amp;cr=22652618">http://www.topcoder.com/tc?module=MemberProfile&amp;cr=22652618</a><br />
<span style="font-size:12s;"><br />
s4sagar@gmail.com</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s4sagar.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s4sagar.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/s4sagar.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/s4sagar.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/s4sagar.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/s4sagar.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/s4sagar.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/s4sagar.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/s4sagar.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/s4sagar.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/s4sagar.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/s4sagar.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/s4sagar.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/s4sagar.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=59&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s4sagar.wordpress.com/2009/07/30/about-recursion/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24b17021440a7ce1ea58c70cde86e511?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s4sagar</media:title>
		</media:content>
	</item>
		<item>
		<title>Useful Links for Programming</title>
		<link>http://s4sagar.wordpress.com/2009/07/09/useful-links-for-programming/</link>
		<comments>http://s4sagar.wordpress.com/2009/07/09/useful-links-for-programming/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 11:40:16 +0000</pubDate>
		<dc:creator>s4sagar</dc:creator>
				<category><![CDATA[Algorithm Programming]]></category>

		<guid isPermaLink="false">http://s4sagar.wordpress.com/?p=20</guid>
		<description><![CDATA[Some Very Useful Educational Tutorials : http://www.topcoder.com/tc?module=Static&#38;d1=tutorials&#38;d2=alg_index The above link has a lot of tutorials to master yourself in Algorithmic C/C++ Programming . The tutorials are very well explained with lots of examples and practise problems . Its a very good way to learn algorithms . The tutorials are written by World&#8217;s Best Programmers accross [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=20&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:red;font-size:17px;"><br />
<strong>Some Very Useful Educational Tutorials : </strong></span><br />
<span style="font-size:12s;"><br />
<a href="http://www.topcoder.com/tc?module=Static&amp;d1=tutorials&amp;d2=alg_index" target="_blank"> http://www.topcoder.com/tc?module=Static&amp;d1=tutorials&amp;d2=alg_index</a></span></p>
<p><span style="font-size:14px;">The above link has a lot of tutorials to master yourself in Algorithmic C/C++ Programming . The tutorials are very well explained with lots of examples and practise problems . Its a very good way to learn algorithms .</span></p>
<p>The tutorials are written by World&#8217;s Best Programmers accross the Globe , so you can expect great clarity and efficiency. I assure you that it will be a very enjoyable experience !<br />
<span style="color:red;font-size:17px;"><br />
<strong>Learning the Standard Template Library (STL) : </strong></span><br />
<span style="font-size:14px;"><br />
Today no programming contest uses the Borland&#8217;s C/C++ Compiler. Every popular contests require the programmers to code in accordance to GCC/ G++ Compiler ( GNU C Compiler ). It has a lot of improvements and new datastructures , and thus makes programming a very comfortable and pleasurable experience. So , learning the STL is almost a must in today&#8217;s scenario.</span></p>
<p>The best place to Learn STL : <a href="http://www.topcoder.com/tc?module=Static&amp;d1=tutorials&amp;d2=standardTemplateLibrary">http://www.topcoder.com/tc?module=Static&amp;d1=tutorials&amp;d2=standardTemplateLibrary</a><br />
<span style="color:red;font-size:17px;"><br />
<strong>An awesome Problem Arcive</strong></span> :  <a href="http://www.topcoder.com/tc?module=ProblemArchive">http://www.topcoder.com/tc?module=ProblemArchive</a><br />
<span style="font-size:14px;"><br />
For beginners : <a href="http://www.topcoder.com/tc?module=ProblemArchive&amp;sr=&amp;er=&amp;sc=&amp;sd=&amp;class=&amp;cat=&amp;div1l=&amp;div2l=1&amp;mind1s=&amp;mind2s=&amp;maxd1s=&amp;maxd2s=&amp;wr=">http://www.topcoder.com/tc?module=ProblemArchive&amp;sr=&amp;er=&amp;sc=&amp;sd=&amp;class=&amp;cat=&amp;div1l=&amp;div2l=1&amp;mind1s=&amp;mind2s=&amp;maxd1s=&amp;maxd2s=&amp;wr=</a><br />
<span style="font-size:14px;"><br />
The above link gives you a lot of very easy problems and helps you a lot to improve your programming skill and to develop a sequential logicalcal flow to solve problems .</span></span></p>
<p>Once you are comfortable solving the Division 2 Level 1 Problems , you can proceed to Division 2 , Level 2 Problems .<br />
<span style="font-size:14px;"><br />
Some world-class Problems : <a href="http://www.spoj.pl/problems/classical/">http://www.spoj.pl/problems/classical/</a><br />
<span style="font-size:14px;"><br />
I would suggest one not to try the above link before gaining a good grip in Algorithm Programming from TopCoder . Trust me , it could be very de-motivating to be unable to solve even a single problem .<br />
<span style="color:red;font-size:17px;"><br />
<strong>Programming Contest Calender : </strong></span><a title="Algorithmist" href="http://www.algorithmist.com/index.php/Programming_Contest_Calendar" target="_blank">http://www.algorithmist.com/index.php/Programming_Contest_Calendar</a> .<br />
<span style="font-size:14px;"><br />
</span></span></span></p>
<p><span style="color:red;font-size:14px;"><em><strong>Hey visitor, pass the word about this blog if you find it useful.</strong></em></span></p>
<p><span style="color:red;font-size:14px;"><em><strong>Feel Free to Leave Your Comments .</strong></em></span></p>
<p><em>Also check out my other article about participating in Algorithm Competitions.</em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s4sagar.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s4sagar.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/s4sagar.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/s4sagar.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/s4sagar.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/s4sagar.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/s4sagar.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/s4sagar.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/s4sagar.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/s4sagar.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/s4sagar.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/s4sagar.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/s4sagar.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/s4sagar.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=20&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s4sagar.wordpress.com/2009/07/09/useful-links-for-programming/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24b17021440a7ce1ea58c70cde86e511?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s4sagar</media:title>
		</media:content>
	</item>
		<item>
		<title>Competing in algorithm competitions</title>
		<link>http://s4sagar.wordpress.com/2009/03/24/competing-in-algorithm-competition/</link>
		<comments>http://s4sagar.wordpress.com/2009/03/24/competing-in-algorithm-competition/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 16:50:44 +0000</pubDate>
		<dc:creator>s4sagar</dc:creator>
				<category><![CDATA[Algorithm Programming]]></category>

		<guid isPermaLink="false">http://s4sagar.wordpress.com/2009/03/24/competing-in-algorithm-competition/</guid>
		<description><![CDATA[The following article was published in the Cypher Magazine of School Of Computer Sciene Engineering at SASTRA University, Thanjavur, India Introduction: Today almost every college has its own online programming contest (SASTRA&#8217;s &#8211; DOPE : www.daksh.sastra.edu/dope/). This article is about the requisites for competing in such competitions and how to go about participating in them. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=3&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:14px;"><em>The following article was published in the <strong>Cypher Magazine</strong> of School Of Computer Sciene Engineering at SASTRA University, Thanjavur, India</em><br />
<strong>Introduction</strong>:<br />
<span style="font-size:14px;"><br />
Today almost every college has its own online programming contest (SASTRA&#8217;s &#8211; DOPE : <a href="http://www.daksh.sastra.edu/dope/">www.daksh.sastra.edu/dope/</a>).<br />
This article is about the requisites for competing in such competitions and how to go about participating in them.<br />
<strong>Requisites</strong>:<br />
<span style="font-size:14px;"><br />
1. Good hold on any programming language &#8211; either C, C++, Java, or C#,<br />
C++, C being the most popular languages used for contests.<br />
<span style="font-size:14px;"><br />
2. Some knowledge about complexities of code, time of execution and<br />
some debugging skills.<br />
<span style="font-size:14px;"><br />
And all the above comes together only with sheer interest and hard work.<br />
The beginning:<br />
1. Make yourself comfortable with the usual C , C++ lab exercises to master<br />
the usage of loops , conditioning and some elementary functions like swap,<br />
search, etc and also some basic data structures including arrays and classes .<br />
<span style="font-size:14px;"><br />
2. If you are planning to code in C++ , make sure you first learn the syntaxes of the<br />
Linux based C++ compiler ( g++ ) used in contests.<br />
<span style="font-size:14px;"><br />
An amazing link :<br />
<a href="http://www.topcoder.com/tc?module=Static&amp;d1=tutorials&amp;d2=standardTemplateLibrary">http://www.topcoder.com/tc?module=Static&amp;d1=tutorials&amp;d2=standardTemplateLibrary</a><br />
<span style="font-size:14px;"><br />
You have to become a member to access the resources.<br />
<span style="font-size:14px;"><br />
C users can use the usual syntax, with just a few variations.<br />
<span style="font-size:14px;"><br />
For JAVA, you might want to go through its set of “collections” : <a href="http://java.sun.com/docs/books/tutorial/collections/index.html" target="_blank">http://java.sun.com/docs/books/tutorial/collections/index.html</a><br />
<a href="http://java.sun.com/docs/books/tutorial/collections/index.html"></a><br />
C# has its base class libraries to be seen : <a href="http://msdn.microsoft.com/en-us/netframework/aa569603.aspx" target="_blank">http://msdn.microsoft.com/en-us/netframework/aa569603.aspx</a><br />
<a href="http://msdn.microsoft.com/en-us/netframework/aa569603.aspx"></a><br />
3. Become a member in sites like topcoder.com, or spoj.pl , or acm and watch out for contests.<br />
<span style="font-size:14px;"><br />
<a href="http://www.topcoder.com/tc?module=Static&amp;d1=calendar&amp;d2=thisMonth"></a> <a href="http://www.algorithmist.com/index.php/Programming_Contest_Calendar"></a> <span style="font-size:14px;"> Algorithmist integrates almost all the leading sites’ contest calendar<br />
<span style="font-size:14px;"><br />
4. Practice the easy problems from the problem set in TopCoder, or other above mentioned sites. I would suggest u to start with the 250 pointers of TopCoder because they are fairly simple and help u get rid of your errors in the initial stages.<br />
<span style="font-size:14px;"><br />
<strong>The process of learning:<br />
</strong><br />
<span style="font-size:14px;"><br />
1.	Keep practicing problems from a problem archive.<br />
<span style="font-size:14px;"><br />
TopCoder&#8217;s archive:  <a href="http://www.topcoder.com/tc?module=ProblemArchive">http://www.topcoder.com/tc?module=ProblemArchive</a><br />
SPOJ&#8217;s archive:  <a href="http://www.spoj.pl/problems/classical/">http://www.spoj.pl/problems/classical/</a><br />
<span style="font-size:14px;"><br />
2. Keep learning new data structures , StandardTemplateLibrary functions<br />
( Not for C coders)Java, C# and algorithms .<br />
An introduction to Algorithms &#8211; by Thomas H Cormen,  is a great book to learn algorithms. It also      explains about code complexities and time of execution. But I would suggest u to start with the book only after you are comfortable with easy problems like TopCoder&#8217;s 250 problems.<br />
<span style="font-size:14px;"><br />
3. Looking at others&#8217; code also helps a lot in the process of learning. Although this feature is not available in SPOJ, or ACM , TopCoder gives you this wonderful feature to look at others&#8217; codes.<br />
<span style="font-size:14px;"><br />
4. Challenging others&#8217; code (again available only in TopCoder ) helps you to identify the boundary cases and this helps u a lot in typing programs which do not access data out of the boundary , or run in an infinite loop.<br />
<span style="font-size:14px;"><br />
Some common un-optimized codes written :</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
1.	Dont use:<br />
for(int i=0;i&lt;strlen(str);i++)<br />
{ … }</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
Instead use<br />
int l=strlen(str);<br />
for(int i=0;i&lt;l;i++)<br />
{ … }</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
Each time you call strlen() , it manually goes through the array counting each character. Suppose the string length is 1000. The first loop will take 1000*1000 operations as strlen is called for every iteration. The second loop takes only 1000 operations ( excluding what goes on inside the loop of course )</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
2.	Size() returns unsigned int :<br />
And if you use something like<br />
for(int i=0;i&lt;A.size() &#8211; 2 ;i++)<br />
{ … }<br />
Where A is a vector, when the size of the vector is less than 2 , the loop still executes abs( A.size() &#8211; 2 ) times since size() returns an unsigned int and when we subtract a number from an unsigned int we get an unsigned int</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
3.	Don’t use long long everywhere in your program. Its very slow compared to int.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
4.	scanf() is faster then cin .</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
5.	Arrays are faster than vectors.<br />
<span style="font-size:14px;"><br />
<strong>Some usual errors from the online judge :<br />
</strong><br />
•	Time Limit Exceeded &#8211; A very familiar judge result on Spoj. It means your program took too long to execute. Try optimizing your program and check for accidental infinite loops.<br />
<span style="font-size:14px;"><br />
•	Wrong Answer &#8211; Your program ran on time, but it did not produce the required output.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
•	Compile Error -Your program had some syntax error. For these errors, click on the text “Compile Error” in the judge result. It`ll take you a page which will list the compile errors and their line numbers in your program.<br />
<span style="font-size:14px;"><br />
•	Runtime Error &#8211; This is usually accompanied by a code like SIGSEV. It can happen due to a lot of reasons, but the two most common are using too much memory ( you can use around 6000*6000*4 bytes of memory ). Other reasons can be there like Divide by Zero.<br />
<span style="font-size:14px;"><br />
<strong>Conclusion :<br />
</strong> &#8220;Practice makes a man perfect&#8221;<br />
Practice, practice and more practice is all that it takes to reach the top.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:red;font-size:14px;"><em><strong>Hey visitor, pass the word about this blog if you find it useful.</strong></em></span></p>
<p><span style="color:red;font-size:14px;"><em><strong>Feel Free to Leave Your Comments . </strong></em></span></p>
<p><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><span style="font-size:14px;"><br />
<span style="font-size:14px;"><br />
- Vidya Sagar , I year , CSE , SASTRA University , India<br />
TopCoder handle : s4sagar<br />
TopCoder profile: <a href="http://www.topcoder.com/tc?module=MemberProfile&amp;cr=22652618">http://www.topcoder.com/tc?module=MemberProfile&amp;cr=22652618</a><a href="http://www.topcoder.com/tc?module=MemberProfile&amp;cr=22652618"><br />
</a></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s4sagar.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s4sagar.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/s4sagar.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/s4sagar.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/s4sagar.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/s4sagar.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/s4sagar.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/s4sagar.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/s4sagar.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/s4sagar.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/s4sagar.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/s4sagar.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/s4sagar.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/s4sagar.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s4sagar.wordpress.com&amp;blog=6864687&amp;post=3&amp;subd=s4sagar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s4sagar.wordpress.com/2009/03/24/competing-in-algorithm-competition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24b17021440a7ce1ea58c70cde86e511?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s4sagar</media:title>
		</media:content>
	</item>
	</channel>
</rss>
