<?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 for csTechie</title>
	<atom:link href="http://cstechie.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://cstechie.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 19 Nov 2009 02:46:52 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Least Common Ancestor in a Tree with only Parent pointers by techie007</title>
		<link>http://cstechie.com/least-common-ancestor-in-a-tree-with-only-parent-pointers/comment-page-1/#comment-31</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Thu, 19 Nov 2009 02:46:52 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=137#comment-31</guid>
		<description>This can be considered as a form of http://cstechie.com/find-intersection-point-of-2-linked-lists/
So I guess the same solution works here.</description>
		<content:encoded><![CDATA[<p>This can be considered as a form of <a href="http://cstechie.com/find-intersection-point-of-2-linked-lists/" rel="nofollow">http://cstechie.com/find-intersection-point-of-2-linked-lists/</a><br />
So I guess the same solution works here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Find Intersection point of 2 linked lists by techie007</title>
		<link>http://cstechie.com/find-intersection-point-of-2-linked-lists/comment-page-1/#comment-30</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Thu, 19 Nov 2009 02:45:40 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=88#comment-30</guid>
		<description>1. Let L1,L2 be the 2 linked lists
2. Find length of L1 and L2 and find the difference DIFF
3. If L1 was longer move initially DIFF pointers.
4. Now move move through L1 and L2 checking for equality till we get both pointing to same object</description>
		<content:encoded><![CDATA[<p>1. Let L1,L2 be the 2 linked lists<br />
2. Find length of L1 and L2 and find the difference DIFF<br />
3. If L1 was longer move initially DIFF pointers.<br />
4. Now move move through L1 and L2 checking for equality till we get both pointing to same object</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Multiplying with out Multiplication by techie007</title>
		<link>http://cstechie.com/multiplying-with-out-multiplication/comment-page-1/#comment-28</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Mon, 16 Nov 2009 06:07:02 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=131#comment-28</guid>
		<description>System.out.println(&quot;Multiplication by 8 &quot;+(num&lt;&lt;3));
    System.out.println(&quot;Multiplication by 7 &quot;+(num&lt;&lt;3)-num);
    System.out.println(&quot;Multiplication by 10 &quot;+(num&lt;&lt;3)+(num&lt;&lt;1));</description>
		<content:encoded><![CDATA[<p>System.out.println(&#8221;Multiplication by 8 &#8220;+(num<&lt;3));<br />
    System.out.println(&#8221;Multiplication by 7 &#8220;+(num<&lt;3)-num);<br />
    System.out.println(&#8221;Multiplication by 10 &#8220;+(num<&lt;3)+(num<&lt;1));</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Find a cycle in a linked list by techie007</title>
		<link>http://cstechie.com/find-a-cycle-in-a-linked-list/comment-page-1/#comment-27</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Mon, 16 Nov 2009 05:25:44 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=134#comment-27</guid>
		<description>1. Start with 2 pointers P and Q
2. Move P 2 pointers and Q one pointer every time
3. Check if P is same as Q
4. If at any point P = Q then we have a cycle

The logic is if P has double speed of Q and there exists a cycle P will overtake Q and will overlapse once both are in the cycle.</description>
		<content:encoded><![CDATA[<p>1. Start with 2 pointers P and Q<br />
2. Move P 2 pointers and Q one pointer every time<br />
3. Check if P is same as Q<br />
4. If at any point P = Q then we have a cycle</p>
<p>The logic is if P has double speed of Q and there exists a cycle P will overtake Q and will overlapse once both are in the cycle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Check whether a linked list is a palindrome by techie007</title>
		<link>http://cstechie.com/check-whether-a-linked-list-is-a-palindrome/comment-page-1/#comment-26</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Sat, 14 Nov 2009 15:28:22 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=123#comment-26</guid>
		<description>1. Find the middle of the linked list as M in O(n) time
2. Reverse the linked list from middle M and the head of the reversed half be E.
3. Check whether Linked List with head E is same as linked list from start
4. reverse once again the linked list with head E and join to creare the original linked list</description>
		<content:encoded><![CDATA[<p>1. Find the middle of the linked list as M in O(n) time<br />
2. Reverse the linked list from middle M and the head of the reversed half be E.<br />
3. Check whether Linked List with head E is same as linked list from start<br />
4. reverse once again the linked list with head E and join to creare the original linked list</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Reverse the words in a sentence by techie007</title>
		<link>http://cstechie.com/reverse-the-words-in-a-sentence/comment-page-1/#comment-25</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Sat, 14 Nov 2009 15:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=126#comment-25</guid>
		<description>1. Reverse the Sentence : dlrow ym olleh 
2. Iterate the sentence and find start and end of each of the words
3. Reverse each of the words in place : world my hello</description>
		<content:encoded><![CDATA[<p>1. Reverse the Sentence : dlrow ym olleh<br />
2. Iterate the sentence and find start and end of each of the words<br />
3. Reverse each of the words in place : world my hello</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Find the smallest window that covers a set of words by techie007</title>
		<link>http://cstechie.com/find-smallest-window-that-covers-all-words/comment-page-1/#comment-22</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Thu, 12 Nov 2009 14:07:27 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=102#comment-22</guid>
		<description>Let S1,S2,....Si be the set of strings
1. Set K pointers, Ki initialised to first occusrance of Si
2. Now current Ki&#039;s forms the first solution to start with
3. Find KNexti for each Si as the next occurance of Si from location Ki
4. Find the shortest KNexti as KNextj , Set Kj as KNextj and check whether current Ki&#039;s form a solution
5. Repeat Step 3 and 4 and the smallest window found so far will be the answer</description>
		<content:encoded><![CDATA[<p>Let S1,S2,&#8230;.Si be the set of strings<br />
1. Set K pointers, Ki initialised to first occusrance of Si<br />
2. Now current Ki&#8217;s forms the first solution to start with<br />
3. Find KNexti for each Si as the next occurance of Si from location Ki<br />
4. Find the shortest KNexti as KNextj , Set Kj as KNextj and check whether current Ki&#8217;s form a solution<br />
5. Repeat Step 3 and 4 and the smallest window found so far will be the answer</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Find all valid words in a string by techie007</title>
		<link>http://cstechie.com/find-all-valid-words-in-a-string/comment-page-1/#comment-20</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Wed, 11 Nov 2009 17:33:35 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=97#comment-20</guid>
		<description>Method 1
1. Create a suffix tree of the String
http://en.wikipedia.org/wiki/Suffix_tree
2. Search all the words in dictionary in the Suffix Tree.
Let N be number of words and L be average length then this will take O(LN) time complexity

Method 2
1. If dictionary is already implemented as a trie
http://en.wikipedia.org/wiki/Trie
2. We can search all suffixes of string S.
This can be done in O(Length(S)*Length(S))

Simple Method
1. Use a hashtable
2. Check all substrings in the hashtable in O(2^(Length(S)))</description>
		<content:encoded><![CDATA[<p>Method 1<br />
1. Create a suffix tree of the String<br />
<a href="http://en.wikipedia.org/wiki/Suffix_tree" rel="nofollow">http://en.wikipedia.org/wiki/Suffix_tree</a><br />
2. Search all the words in dictionary in the Suffix Tree.<br />
Let N be number of words and L be average length then this will take O(LN) time complexity</p>
<p>Method 2<br />
1. If dictionary is already implemented as a trie<br />
<a href="http://en.wikipedia.org/wiki/Trie" rel="nofollow">http://en.wikipedia.org/wiki/Trie</a><br />
2. We can search all suffixes of string S.<br />
This can be done in O(Length(S)*Length(S))</p>
<p>Simple Method<br />
1. Use a hashtable<br />
2. Check all substrings in the hashtable in O(2^(Length(S)))</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Find Median of 2 Sorted Arrays by syam</title>
		<link>http://cstechie.com/find-median-of-2-sorted-arrays/comment-page-1/#comment-16</link>
		<dc:creator>syam</dc:creator>
		<pubDate>Tue, 10 Nov 2009 14:25:30 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=84#comment-16</guid>
		<description>1. Let A and B be 2 sorted arrays
2. We can check whether A[i] is median in constant time.
3. Suppose A[i] is median, then it is greater than exactly i-1 elements in A, and it has to be exaclty n/2 -(i-1) elements in B.
4. It requires constant time to check if B[j] &lt; A[i] &lt; B[j + 1]
5. If A[i] is not the median, then depending on whether A[i] is greater or less than B[j] and B[j + 1], you know that A[i] is either greater than or less than the median. Thus you can binary search for A[i] in (lg n) 

See solution here :
http://ocw.mit.edu/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-046JFall-2005/30C68118-E436-4FE3-8C79-6BAFBB07D935/0/ps9sol.pdf</description>
		<content:encoded><![CDATA[<p>1. Let A and B be 2 sorted arrays<br />
2. We can check whether A[i] is median in constant time.<br />
3. Suppose A[i] is median, then it is greater than exactly i-1 elements in A, and it has to be exaclty n/2 -(i-1) elements in B.<br />
4. It requires constant time to check if B[j] < A[i] < B[j + 1]<br />
5. If A[i] is not the median, then depending on whether A[i] is greater or less than B[j] and B[j + 1], you know that A[i] is either greater than or less than the median. Thus you can binary search for A[i] in (lg n) </p>
<p>See solution here :<br />
<a href="http://ocw.mit.edu/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-046JFall-2005/30C68118-E436-4FE3-8C79-6BAFBB07D935/0/ps9sol.pdf" rel="nofollow">http://ocw.mit.edu/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-046JFall-2005/30C68118-E436-4FE3-8C79-6BAFBB07D935/0/ps9sol.pdf</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Write a program to say whether a string is a rotation of another by techie007</title>
		<link>http://cstechie.com/write-a-program-to-say-whether-a-string-is-a-rotation-of-another/comment-page-1/#comment-15</link>
		<dc:creator>techie007</dc:creator>
		<pubDate>Mon, 09 Nov 2009 13:39:09 +0000</pubDate>
		<guid isPermaLink="false">http://cstechie.com/?p=81#comment-15</guid>
		<description>check 
1. S1 and S2 are of same length
2. S1 is in S2S2</description>
		<content:encoded><![CDATA[<p>check<br />
1. S1 and S2 are of same length<br />
2. S1 is in S2S2</p>
]]></content:encoded>
	</item>
</channel>
</rss>
