<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Interview Questions: Loops in Linked Lists</title>
	<atom:link href="http://20bits.com/articles/interview-questions-loops-in-linked-lists/feed/" rel="self" type="application/rss+xml" />
	<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=interview-questions-loops-in-linked-lists</link>
	<description>Driven by Data</description>
	<lastBuildDate>Sat, 09 Jul 2011 18:30:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<item>
		<title>By: vidarh</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-5590</link>
		<dc:creator>vidarh</dc:creator>
		<pubDate>Mon, 20 Jun 2011 14:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-5590</guid>
		<description>Just checked my Disqus profile and found this old reply... 

Reasoning out the &quot;Tortoise and hare&quot; solution is not that uncommon - I&#039;ve  not had people do it in an interview myself, but I&#039;ve talked to enough people who have found the solution independently to not think that the solution requires any particularly outstanding intelligence to come up with. I did in fact have no idea that Bob Floyd invented this algorithm until just now. Once I figured it out I didn&#039;t think any more about it because of the simplicity of it; I&#039;m used to &quot;inventing&quot; algorithms that turn out to have been invented a long time ago and reinvented by every CS or maths student, graduate or self taught programmers ever since. Most people who study technical subjects or work with them end up doing this sooner or later.The solution flows fairly logically from a few simple observations, and the hard part is making the first few of those observations - pure chance alone would make a reasonable number of people figure out enough of the starting points to be able to figure out that solution.(and  this is a major reason why expecting the *answer* to these types of questions, regardless how hard or easy the problem is is the wrong approach to using them in interviews)Generally, for the people I&#039;ve talked to who has figured out this solution, the process is generally to try to figure out what makes a cycle different, and then try realize that if you can first make sure that the node you&#039;re on is inside the cycle if there is one, then the problem is trivial. Then all that is left is to figure out how to move to a node inside the cycle without getting stuck in a loop while trying to check the node you&#039;re moving across. Finally, you need to realize that it&#039;s not a disaster if you traverse a node more than once without figuring out if there&#039;s a loop the first time around - once you do that, it all just snaps into place. Give enough people this question, and someone will eventually muddle through it without any great insight or intelligence at all, just by stumbling onto these few realizations.Your appeal to authority and assumptions of how much time they must have spent solving a problem with no justification for why they would be particularly good at solving this type of problem, nor for why you think he must have spent so much time on it speaks volumes.(oh, and it&#039;s quite distasteful to accuse someone of lying while hiding behind anonymity, and also to jump to conclusions about how I supposedly &quot;make job candidates suffer&quot; for it. Particularly since in this case I&#039;ve never excluded any candidates for failing to solve this problem, but I have *hired* candidates in several instances where a significant part of what convinced me was the way they&#039;ve answered this question despite not solving it)</description>
		<content:encoded><![CDATA[<p>Just checked my Disqus profile and found this old reply&#8230; </p>
<p>Reasoning out the &#8220;Tortoise and hare&#8221; solution is not that uncommon &#8211; I&#8217;ve  not had people do it in an interview myself, but I&#8217;ve talked to enough people who have found the solution independently to not think that the solution requires any particularly outstanding intelligence to come up with. I did in fact have no idea that Bob Floyd invented this algorithm until just now. Once I figured it out I didn&#8217;t think any more about it because of the simplicity of it; I&#8217;m used to &#8220;inventing&#8221; algorithms that turn out to have been invented a long time ago and reinvented by every CS or maths student, graduate or self taught programmers ever since. Most people who study technical subjects or work with them end up doing this sooner or later.The solution flows fairly logically from a few simple observations, and the hard part is making the first few of those observations &#8211; pure chance alone would make a reasonable number of people figure out enough of the starting points to be able to figure out that solution.(and  this is a major reason why expecting the *answer* to these types of questions, regardless how hard or easy the problem is is the wrong approach to using them in interviews)Generally, for the people I&#8217;ve talked to who has figured out this solution, the process is generally to try to figure out what makes a cycle different, and then try realize that if you can first make sure that the node you&#8217;re on is inside the cycle if there is one, then the problem is trivial. Then all that is left is to figure out how to move to a node inside the cycle without getting stuck in a loop while trying to check the node you&#8217;re moving across. Finally, you need to realize that it&#8217;s not a disaster if you traverse a node more than once without figuring out if there&#8217;s a loop the first time around &#8211; once you do that, it all just snaps into place. Give enough people this question, and someone will eventually muddle through it without any great insight or intelligence at all, just by stumbling onto these few realizations.Your appeal to authority and assumptions of how much time they must have spent solving a problem with no justification for why they would be particularly good at solving this type of problem, nor for why you think he must have spent so much time on it speaks volumes.(oh, and it&#8217;s quite distasteful to accuse someone of lying while hiding behind anonymity, and also to jump to conclusions about how I supposedly &#8220;make job candidates suffer&#8221; for it. Particularly since in this case I&#8217;ve never excluded any candidates for failing to solve this problem, but I have *hired* candidates in several instances where a significant part of what convinced me was the way they&#8217;ve answered this question despite not solving it)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: windows utility tool</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-5314</link>
		<dc:creator>windows utility tool</dc:creator>
		<pubDate>Tue, 25 Jan 2011 02:42:54 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-5314</guid>
		<description>Thanks for your explanation:)</description>
		<content:encoded><![CDATA[<p>Thanks for your explanation:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 800 calorie diet</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-5093</link>
		<dc:creator>800 calorie diet</dc:creator>
		<pubDate>Tue, 13 Jul 2010 01:17:40 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-5093</guid>
		<description>Golden. Great, useful info.</description>
		<content:encoded><![CDATA[<p>Golden. Great, useful info.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Air Climber</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-5073</link>
		<dc:creator>Air Climber</dc:creator>
		<pubDate>Sat, 03 Jul 2010 21:36:13 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-5073</guid>
		<description>No this has to be a web programming language</description>
		<content:encoded><![CDATA[<p>No this has to be a web programming language</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magic Jack</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-5074</link>
		<dc:creator>Magic Jack</dc:creator>
		<pubDate>Fri, 02 Jul 2010 20:07:53 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-5074</guid>
		<description>Is this for C++?</description>
		<content:encoded><![CDATA[<p>Is this for C++?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vidarislying</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-5075</link>
		<dc:creator>vidarislying</dc:creator>
		<pubDate>Thu, 01 Jul 2010 18:22:54 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-5075</guid>
		<description>Sorry to say vidar you&#039;re blowing hot air out some orifice! the tortoise and hare solution you claim to have &quot;reasoned&quot; out in an interview was invented by Bob Floyd who won the Turing award which means he was a computer science genius - I really doubt even he figured it out in 15 minutes which is by far the maximum time interviewers would allow you to solve a problem. People like you who pretend to be  smart are the worst interviewers because you lie to yourself about your abilities and make job candidates suffer for it.</description>
		<content:encoded><![CDATA[<p>Sorry to say vidar you&#39;re blowing hot air out some orifice! the tortoise and hare solution you claim to have &#8220;reasoned&#8221; out in an interview was invented by Bob Floyd who won the Turing award which means he was a computer science genius &#8211; I really doubt even he figured it out in 15 minutes which is by far the maximum time interviewers would allow you to solve a problem. People like you who pretend to be  smart are the worst interviewers because you lie to yourself about your abilities and make job candidates suffer for it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gournew</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-4944</link>
		<dc:creator>gournew</dc:creator>
		<pubDate>Thu, 08 Apr 2010 11:43:31 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-4944</guid>
		<description>How to break the loop:&lt;br&gt;step1:&lt;br&gt;Detect  the loop using slow(p1) and first pointer(p2)&lt;br&gt;step2:-&lt;br&gt;keep one poionter (p1)there and reset pointer (p2=head)to head.&lt;br&gt;step 3:&lt;br&gt;go still both are same now make p2-&gt;next=NULL. &lt;br&gt;complete code::-&lt;br&gt;&lt;a href=&quot;http://goursaha.freeoda.com/DataStructure/LoopDetectionInLL.html&quot; rel=&quot;nofollow&quot;&gt;http://goursaha.freeoda.com/DataStructure/LoopD...&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>How to break the loop:<br />step1:<br />Detect  the loop using slow(p1) and first pointer(p2)<br />step2:-<br />keep one poionter (p1)there and reset pointer (p2=head)to head.<br />step 3:<br />go still both are same now make p2-&gt;next=NULL. <br />complete code::-<br /><a href="http://goursaha.freeoda.com/DataStructure/LoopDetectionInLL.html" rel="nofollow">http://goursaha.freeoda.com/DataStructure/LoopD&#8230;</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: axvpast</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-4861</link>
		<dc:creator>axvpast</dc:creator>
		<pubDate>Tue, 23 Feb 2010 02:45:58 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-4861</guid>
		<description>For my opinion the best solution is just extend Node by additional attribute (visited).&lt;br&gt;After that we have linear algorithm complexity without performance and resources problems. In all other cases we need more memory or more CPU time.</description>
		<content:encoded><![CDATA[<p>For my opinion the best solution is just extend Node by additional attribute (visited).<br />After that we have linear algorithm complexity without performance and resources problems. In all other cases we need more memory or more CPU time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jc</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-3197</link>
		<dc:creator>jc</dc:creator>
		<pubDate>Fri, 06 Jun 2008 16:09:01 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-3197</guid>
		<description>In the &#039;easy solution&#039; you also first need to check for a list that has 2 nodes that are in loop.</description>
		<content:encoded><![CDATA[<p>In the &#8216;easy solution&#8217; you also first need to check for a list that has 2 nodes that are in loop.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesse</title>
		<link>http://20bits.com/articles/interview-questions-loops-in-linked-lists/comment-page-1/#comment-2849</link>
		<dc:creator>Jesse</dc:creator>
		<pubDate>Wed, 14 May 2008 17:14:49 +0000</pubDate>
		<guid isPermaLink="false">http://20bits.com/?p=99#comment-2849</guid>
		<description>Shaneal,

You&#039;re right.</description>
		<content:encoded><![CDATA[<p>Shaneal,</p>
<p>You&#8217;re right.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

