<?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</title>
	<atom:link href="http://technote.wsjoung.com/2008/02/06/amazon-interview/feed/" rel="self" type="application/rss+xml" />
	<link>http://technote.wsjoung.com/2008/02/06/amazon-interview/</link>
	<description>simple note</description>
	<lastBuildDate>Fri, 09 Dec 2011 14:46:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Mohammad Shariq</title>
		<link>http://technote.wsjoung.com/2008/02/06/amazon-interview/comment-page-1/#comment-86</link>
		<dc:creator>Mohammad Shariq</dc:creator>
		<pubDate>Tue, 03 Feb 2009 06:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://wsjoung.wordpress.com/?p=76#comment-86</guid>
		<description>take two pointers,initially both are holding Head node of Linked List .

Step1 : move the first pointer , N node ahead  .  Means now first pointer pointing to the Nth node of linked list .

Step2 : Now move both pointer together until first pointer reached at tail.

Step3: At this condition  the Second pointer is pointing to Nth node from last.</description>
		<content:encoded><![CDATA[<p>take two pointers,initially both are holding Head node of Linked List .</p>
<p>Step1 : move the first pointer , N node ahead  .  Means now first pointer pointing to the Nth node of linked list .</p>
<p>Step2 : Now move both pointer together until first pointer reached at tail.</p>
<p>Step3: At this condition  the Second pointer is pointing to Nth node from last.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carter Page</title>
		<link>http://technote.wsjoung.com/2008/02/06/amazon-interview/comment-page-1/#comment-85</link>
		<dc:creator>Carter Page</dc:creator>
		<pubDate>Thu, 07 Feb 2008 14:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://wsjoung.wordpress.com/?p=76#comment-85</guid>
		<description>There&#039;s two ways to do this, the first uses less resources, but requires two passes as you mention.  Only way to do it efficiently in one pass would be to keep references to the last n values you&#039;ve looked at, storing them in a queue of length n.  Add the latest one, and if the queue is full pop out the oldest one, since it is surely &gt; n from the end.  Since you&#039;re only saving references, it&#039;s not a huge memory hog unless n gets to be too big, then it would be a trade off between the two, and it would probably be worth bonus points to explain the measurements of that trade off.</description>
		<content:encoded><![CDATA[<p>There&#8217;s two ways to do this, the first uses less resources, but requires two passes as you mention.  Only way to do it efficiently in one pass would be to keep references to the last n values you&#8217;ve looked at, storing them in a queue of length n.  Add the latest one, and if the queue is full pop out the oldest one, since it is surely &gt; n from the end.  Since you&#8217;re only saving references, it&#8217;s not a huge memory hog unless n gets to be too big, then it would be a trade off between the two, and it would probably be worth bonus points to explain the measurements of that trade off.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

