<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7991884387761107092</id><updated>2012-02-16T23:17:58.877+05:30</updated><category term='Backtracking'/><category term='Sorting'/><category term='Data Structure'/><category term='Linked Lists'/><category term='UNSOLVED'/><category term='Common Puzzles'/><category term='Tries'/><category term='Numeric Puzzles'/><category term='Arrays'/><category term='LVL:AVG'/><category term='Bit Twiddling'/><category term='Dynamic Programming'/><category term='Trees'/><category term='Hashing'/><category term='Interview Questions'/><category term='Graph Algorithms'/><category term='Coin Puzzles'/><category term='Java'/><category term='J2EE'/><category term='Programming'/><title type='text'>Algos, Puzzles and Programming Questions</title><subtitle type='html'>Feel free to contribute, however it will be moderated to curb spams.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>63</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3258827361826499509</id><published>2010-01-21T13:39:00.000+05:30</published><updated>2010-01-21T13:39:14.694+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sorting'/><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>Searching and sorting in a 2-d array</title><content type='html'>Suppose you have a 2-d array with integers sorted both horizontally and vertically.&lt;br /&gt;a) Search for the occurrence of a value in the array&lt;br /&gt;b) Sort the array into a single-dimensional array&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3258827361826499509?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3258827361826499509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3258827361826499509&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3258827361826499509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3258827361826499509'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2010/01/searching-and-sorting-in-2-d-array.html' title='Searching and sorting in a 2-d array'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-268104705883840531</id><published>2010-01-18T11:14:00.000+05:30</published><updated>2010-01-18T11:14:38.698+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>Find the number of negative elements in most efficient way</title><content type='html'>Given an n X n array with rows sorted and cols sorted, find the number of negative elements in most efficient way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-268104705883840531?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/268104705883840531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=268104705883840531&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/268104705883840531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/268104705883840531'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2010/01/find-number-of-negative-elements-in.html' title='Find the number of negative elements in most efficient way'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-1561768633701658248</id><published>2009-12-31T11:37:00.001+05:30</published><updated>2009-12-31T11:38:32.241+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linked Lists'/><category scheme='http://www.blogger.com/atom/ns#' term='LVL:AVG'/><title type='text'>Sort a ordered linkedlist</title><content type='html'>A singly LL is given such that there is alternate ordering between the elements.&lt;br /&gt;&lt;br /&gt;Ex: 1-&gt;2-&gt;13-&gt;14-&gt;11-&gt;5-&gt;4-&gt;null&lt;br /&gt;&lt;br /&gt;Give an efficient O(n) algo to sort such a LL. There can be multiple such orderings in the given LL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-1561768633701658248?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/1561768633701658248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=1561768633701658248&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1561768633701658248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1561768633701658248'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/12/sort-ordered-linkedlist.html' title='Sort a ordered linkedlist'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2742313345724263508</id><published>2009-12-19T17:08:00.000+05:30</published><updated>2009-12-19T17:08:04.308+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trees'/><title type='text'>find height of a node in BST</title><content type='html'>Given a BST T and a node N in T such that all leaf nodes are connected in doubly linkedlist fashion, find height of the node N in T.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2742313345724263508?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2742313345724263508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2742313345724263508&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2742313345724263508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2742313345724263508'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/12/find-height-of-node-in-bst.html' title='find height of a node in BST'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3320482127754538622</id><published>2009-09-28T23:48:00.002+05:30</published><updated>2009-09-28T23:48:47.458+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dynamic Programming'/><title type='text'>Given two strings, find the minimum no. of steps required to covert one to the other?</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3320482127754538622?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3320482127754538622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3320482127754538622&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3320482127754538622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3320482127754538622'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/09/given-two-strings-find-minimum-no-of.html' title='Given two strings, find the minimum no. of steps required to covert one to the other?'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2202034539451118085</id><published>2009-09-08T22:50:00.000+05:30</published><updated>2009-09-08T22:50:28.171+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph Algorithms'/><title type='text'>Birthday Calendar</title><content type='html'>Implement the birthday diary calendar to keep records of all birthdays of your friends&lt;br /&gt;1) what underlying data structure(s) you will use so that the memory consumption should be optimum [i.e if you have only 12 birthday entries you should not hold memory for all 365 days of the year].&lt;br /&gt;&lt;br /&gt;2) You should be able to view the data (birthdays) with closest birthday first [i.e 7th July should come before 11 Aug].&lt;br /&gt;&lt;br /&gt;3) How will you keep this data sorted (for question 2), everytime you insert a new birthday entry. This sorting should be as optimum as possible [mergesort etc will not be very beneficial bcoz ideally you won't have thousands or millions of birthday]&lt;br /&gt;&lt;br /&gt;4) How will you handle 2 or N number of birthdays on same day&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2202034539451118085?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2202034539451118085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2202034539451118085&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2202034539451118085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2202034539451118085'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/09/birthday-calendar.html' title='Birthday Calendar'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-5640770033031074829</id><published>2009-09-08T22:41:00.000+05:30</published><updated>2009-09-08T22:41:46.452+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dynamic Programming'/><title type='text'>Given a string of n characters, find the longest palindrome in the string.</title><content type='html'>O(n2) is simple, O(n) is nice&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-5640770033031074829?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/5640770033031074829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=5640770033031074829&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5640770033031074829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5640770033031074829'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/09/given-string-of-n-characters-find.html' title='Given a string of n characters, find the longest palindrome in the string.'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8371116586726571938</id><published>2009-09-08T22:35:00.002+05:30</published><updated>2009-09-08T22:35:43.125+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph Algorithms'/><title type='text'>Given an undirected graph G(V,E), design an algo to detect whether there is a triangle in the graph?</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8371116586726571938?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8371116586726571938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8371116586726571938&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8371116586726571938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8371116586726571938'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/09/given-undirected-graph-gve-design-algo.html' title='Given an undirected graph G(V,E), design an algo to detect whether there is a triangle in the graph?'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2212775737787874250</id><published>2009-08-30T03:37:00.002+05:30</published><updated>2009-08-30T03:37:44.738+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>Find the minimum substring containing all unique characters atleast once in the given string</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2212775737787874250?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2212775737787874250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2212775737787874250&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2212775737787874250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2212775737787874250'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/08/find-minimum-substring-containing-all.html' title='Find the minimum substring containing all unique characters atleast once in the given string'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3381772299568043782</id><published>2009-08-30T02:56:00.000+05:30</published><updated>2009-08-30T02:56:26.690+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>Find pairs from the given array</title><content type='html'>Given an array X, find tuples (xi, xj) such that j&gt;i and xj is the immediate number greater than xi in the given array?&lt;br /&gt;&lt;br /&gt;Ex Problem: X: {5, 4, 1, 3, 7}&lt;br /&gt;Solution:&lt;br /&gt;{5, 7}&lt;br /&gt;{4, 7}&lt;br /&gt;{1, 3}&lt;br /&gt;{3, 7}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3381772299568043782?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3381772299568043782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3381772299568043782&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3381772299568043782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3381772299568043782'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/08/find-pairs-from-given-array.html' title='Find pairs from the given array'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-6194847273550105028</id><published>2009-08-30T00:09:00.006+05:30</published><updated>2009-08-30T00:22:51.547+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Numeric Puzzles'/><title type='text'>Random Number Generation - II</title><content type='html'>Given a function rand5() which generates values between 0-5 with equal probablities, how would you create another function rand7() which generates values between 0-7?&lt;br /&gt;&lt;br /&gt;For that matter given a function randM() which generates numbers between 0-M, how would you create another function randN() which generates numbers between 0-N with equal probabilities? Is it possible for every value of M,N?&lt;br /&gt;&lt;br /&gt;PS: I'm calling this "Random Number Generation - II" because we already have another version of this problem &lt;a target="_blank" href="http://unclelog.blogspot.com/2008/04/random-number-generation.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span class="hints"&gt;Think in terms of possible values being generated by the given randX() function and map to all the possible values to be generated by the target randY() function&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-6194847273550105028?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/6194847273550105028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=6194847273550105028&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/6194847273550105028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/6194847273550105028'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2009/08/random-number-generation-ii.html' title='Random Number Generation - II'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-5427387734322943128</id><published>2008-11-11T21:48:00.001+05:30</published><updated>2008-11-11T21:49:39.326+05:30</updated><title type='text'>Find union of two sets in O(1)</title><content type='html'>&lt;span class="hints"&gt;Use bit-map&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-5427387734322943128?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/5427387734322943128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=5427387734322943128&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5427387734322943128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5427387734322943128'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/11/find-union-of-two-sets-in-o1.html' title='Find union of two sets in O(1)'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2630637915579907314</id><published>2008-09-05T20:47:00.004+05:30</published><updated>2008-09-07T11:41:15.506+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linked Lists'/><title type='text'>Palindrome in LinkedList</title><content type='html'>Given a linked list with node as given below:&lt;br /&gt;&lt;br /&gt;struct node&lt;br /&gt;{&lt;br /&gt;   char info;&lt;br /&gt;   struct node *next;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Give an O(n) algorithm to find if its a palindrome or not? You can not use more than O(1) space.&lt;br /&gt;&lt;br /&gt;&lt;span class="hints"&gt;Two pointers to explore the list, reach the mid-point reverse the first half and compare the two halves&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2630637915579907314?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2630637915579907314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2630637915579907314&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2630637915579907314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2630637915579907314'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/09/palindrome-in-linkedlist.html' title='Palindrome in LinkedList'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-4252118876428838441</id><published>2008-09-05T20:41:00.003+05:30</published><updated>2008-09-07T11:44:20.046+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph Algorithms'/><title type='text'>Maze Searching</title><content type='html'>Given a 2-d maze of characters, find if there exists a word "Algorithms" in the maze. By exists we mean it exists in a row, a column or like snakes (diagonals prohibited though)?&lt;br /&gt;&lt;br /&gt;By snakes, we mean like following&lt;br /&gt;&lt;br /&gt;A . . . M S    &lt;br /&gt;L G . T H .&lt;br /&gt;. O R I . .&lt;br /&gt;&lt;span class="hints"&gt;Use DFS and explore the maze as and when letters are found&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-4252118876428838441?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/4252118876428838441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=4252118876428838441&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4252118876428838441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4252118876428838441'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/09/maze-searching.html' title='Maze Searching'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-57198111890833020</id><published>2008-06-16T10:31:00.001+05:30</published><updated>2008-06-16T10:33:45.247+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Backtracking'/><category scheme='http://www.blogger.com/atom/ns#' term='Graph Algorithms'/><title type='text'>Generating Graphs</title><content type='html'>Given n nodes, &lt;br /&gt;&lt;br /&gt;1. generate all possible directed subgraphs.&lt;br /&gt;2. generate all possible undirected subgraphs.&lt;br /&gt;&lt;br /&gt;Easier version:&lt;br /&gt;&lt;br /&gt;Given n nodes,&lt;br /&gt;1. generate all possible directed subgraphs of n nodes,&lt;br /&gt;2. generate all possible undirected subgraphs of n nodes,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-57198111890833020?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/57198111890833020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=57198111890833020&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/57198111890833020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/57198111890833020'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/06/generating-graphs.html' title='Generating Graphs'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2747140000169651745</id><published>2008-06-14T20:20:00.004+05:30</published><updated>2008-06-14T20:44:43.252+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='UNSOLVED'/><title type='text'>PubTrivia - a pub where algos are served alongwith drinks!</title><content type='html'>You and your friends have gotten together for a Trivia night at a local pub.There are &lt;span style="font-weight: bold;"&gt;N &lt;/span&gt;questions asked during the night.Each question is worth a number of points; the i-th element of the &lt;span style="font-weight: bold;"&gt;points array&lt;/span&gt; corresponds to the score received by you if you correctly answer the i-th question, but you lose that many points if you answer that incorrectly. The questions are given in the order specified and you must answer each question before the next is asked. In addition, after each correct answer you will receive a token. If you then have &lt;span style="font-weight: bold;"&gt;tokensNeeded&lt;/span&gt; tokens, the pub will immediately take all of your tokens and award you additional bonus points. However, if you get the question wrong, the pub will take away all of your tokens without giving you any bonuses. The element i of the &lt;span style="font-weight: bold;"&gt;bonuses array&lt;/span&gt; corresponds to the bonus you receive if you win the bonus on question i.&lt;br /&gt;Note that it is possible to win multiple bonuses during the game.&lt;br /&gt;You know the answer to all the questions and want to maximize the number of points you receive.&lt;br /&gt;Give an algorithm to obtain the maximum points that you can receive if you correctly choose which questions to answer.&lt;br /&gt;&lt;br /&gt;Inputs :&lt;br /&gt;N&lt;br /&gt;tokensNeeded&lt;br /&gt;p - array of points&lt;br /&gt;b - array of bonuses&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2747140000169651745?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2747140000169651745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2747140000169651745&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2747140000169651745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2747140000169651745'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/06/pubtrivia-pub-where-algos-are-served.html' title='PubTrivia - a pub where algos are served alongwith drinks!'/><author><name>Larry Uncle</name><uri>http://www.blogger.com/profile/05805055812552711911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://bp1.blogger.com/_ELBYjsUZbGg/SCGiNJg2sFI/AAAAAAAAAAY/7yggR9lfbjs/S220/thinker.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-1944663007099946658</id><published>2008-05-21T13:37:00.003+05:30</published><updated>2008-09-07T11:45:22.184+05:30</updated><title type='text'>Calendar Cubes</title><content type='html'>A corporate businessman has two cubes on his office desk. Every day he arranges both cubes so that the front faces show the current day of the month. What numbers are on the faces of the cubes to allow this?&lt;br /&gt;&lt;br /&gt;&lt;span class="hints"&gt;I have come up with a solution which I would call "sly" and really "unfair"!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-1944663007099946658?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/1944663007099946658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=1944663007099946658&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1944663007099946658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1944663007099946658'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/05/calendar-cubes.html' title='Calendar Cubes'/><author><name>Larry Uncle</name><uri>http://www.blogger.com/profile/05805055812552711911</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://bp1.blogger.com/_ELBYjsUZbGg/SCGiNJg2sFI/AAAAAAAAAAY/7yggR9lfbjs/S220/thinker.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8092440746302007719</id><published>2008-05-07T10:25:00.006+05:30</published><updated>2008-09-07T12:20:20.639+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Difference between Singleton and Static implementations</title><content type='html'>&lt;span class="hints"&gt;&lt;br /&gt;(1) Static implementations cannot be extended(only static fields and methods can be extended) whereas Singleton implementations can be extended and its methods can be overridden.&lt;br /&gt;(2) Static implementations cannot extend other class's instance fields/methods while Singleton implementations can.&lt;br /&gt;(3) Static implementations must be initialized at the class loading time however Singleton implementations can be lazy initialized or asynchronously initialized.&lt;br /&gt;(4) Static implementations cannot be initialized with a STATE (parameter), whereas Singleton implementations can be. &lt;br /&gt;(5) Static implementations can still have instances (unwanted instances) whereas Singleton implementations prevents it.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8092440746302007719?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8092440746302007719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8092440746302007719&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8092440746302007719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8092440746302007719'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/05/difference-between-singleton-and-static.html' title='Difference between Singleton and Static implementations'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-4784438802285254072</id><published>2008-04-16T18:51:00.003+05:30</published><updated>2008-04-17T18:17:26.354+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Backtracking'/><title type='text'>Exchange problem</title><content type='html'>Its new year time and your company has sent T-Shirts of varying sizes from HQ (read US). The problem is that the sizes in US and the sizes in India don't really match. So a guy with L size in India would like to settle for M size in US, one with XXL in India would like to go for XL and so on. Employees in India are bugged up and want to exchange it with appropriate sized T-Shirt. Now that the management didn't take care of it before sending the T-Shirts to India, you have been assigned by the Indian management to arrange an exchange between the employees. How would you go about it? Also describe your algorithm. If all this information is stored in the database, write a query that would do the job.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-4784438802285254072?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/4784438802285254072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=4784438802285254072&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4784438802285254072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4784438802285254072'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/04/exchange-problem.html' title='Exchange problem'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8120426107751126508</id><published>2008-04-16T11:24:00.003+05:30</published><updated>2008-04-16T11:41:41.470+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Numeric Puzzles'/><title type='text'>Random Number Generation</title><content type='html'>Given a function random(0,1) which randomly generates 0 or 1 with equal probabilities, extend its functionality to generate random numbers for an interval [a,b], i.e. implement random(a,b), for all 0 =&lt; a &lt; b. Prove that the strategy is uniformly random or would you like to put some conditions on a and b?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another version: Given a random function random() which generates 0,1 but with uneven probabilities, create a random function newrandom() which generates 0,1 with even probabilities. Uneven probabilities mean if probability of getting 0 from random is p, that of 1 is (1-p) but p!=(1-p)!=1/2&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8120426107751126508?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8120426107751126508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8120426107751126508&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8120426107751126508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8120426107751126508'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/04/random-number-generation.html' title='Random Number Generation'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-639615615855390462</id><published>2008-04-15T11:23:00.000+05:30</published><updated>2008-04-15T11:24:06.869+05:30</updated><title type='text'>array question again</title><content type='html'>Suppose you are having an array of n integer. All the elements in the array are unique&lt;br /&gt;except one element. That one special element in array is repeating in array in order of power two(means even repetition)&lt;br /&gt;&lt;br /&gt;example - 1 2 3 4 5 6 5 7 8&lt;br /&gt;&lt;br /&gt;all element in this array are unique except 5.. and 5 is repeating 2 times (power of 2).&lt;br /&gt;we need an algo to find this special element in array&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-639615615855390462?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/639615615855390462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=639615615855390462&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/639615615855390462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/639615615855390462'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/04/array-question-again.html' title='array question again'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-6529972158213798748</id><published>2008-04-05T16:27:00.002+05:30</published><updated>2008-04-05T16:29:12.867+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Why is String immutable in Java or are they?</title><content type='html'>Ref: http://www.javaspecialists.eu/archive/Issue014.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-6529972158213798748?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/6529972158213798748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=6529972158213798748&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/6529972158213798748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/6529972158213798748'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/04/why-is-string-immutable-in-java-or-are.html' title='Why is String immutable in Java or are they?'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-6406246773556507946</id><published>2008-04-01T23:45:00.004+05:30</published><updated>2008-04-02T11:15:38.509+05:30</updated><title type='text'>Team Photo Problem</title><content type='html'>Since three guys (Ghoida, Nini and Dinu Kaka) from our team have decided to move on, its time to take a team photo. Camera man proposed that for a nice photo people should arrange themselves in such a way that the height difference between two adjacent guys are minimum. Since Dinu Kaka is the senior most of all three, we decided to keep him at the center and Nini and Ghoida will be at either ends (one at left and the other at right). Nini being so enthusiastic about his analytical skills decides to write an algorithm that will ensure that average height gaps of the arrangement is minimum. Any idea how he would do it? If there are even team members, Dinu Kaka may choose any of the two mid positions as he wish (and since he is a nice guy, he would accept any of the two positions that Nini tells him to go to).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-6406246773556507946?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/6406246773556507946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=6406246773556507946&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/6406246773556507946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/6406246773556507946'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/04/team-photo-problem.html' title='Team Photo Problem'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2475883543788801500</id><published>2008-04-01T16:03:00.003+05:30</published><updated>2008-04-02T10:23:15.674+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph Algorithms'/><title type='text'>another graph problem</title><content type='html'>&lt;span style="font-family: times new roman;"&gt;Find out if there is cycle in a given graph?&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2475883543788801500?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2475883543788801500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2475883543788801500&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2475883543788801500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2475883543788801500'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/04/another-graph-problem.html' title='another graph problem'/><author><name>IamWhatIam</name><uri>http://www.blogger.com/profile/17509093444236094955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2083260401086513633</id><published>2008-04-01T00:13:00.004+05:30</published><updated>2008-04-01T00:17:54.598+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='UNSOLVED'/><category scheme='http://www.blogger.com/atom/ns#' term='Backtracking'/><category scheme='http://www.blogger.com/atom/ns#' term='Dynamic Programming'/><title type='text'>Knapsack Problem Variation</title><content type='html'>Given infinite supply of "n" denominations of coins and a change amount "A", give an algorithm to use minimum number of coins to do the transaction?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2083260401086513633?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2083260401086513633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2083260401086513633&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2083260401086513633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2083260401086513633'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/04/knapsack-problem-variation.html' title='Knapsack Problem Variation'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8648827358021243487</id><published>2008-03-31T23:56:00.003+05:30</published><updated>2008-04-01T00:08:55.127+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph Algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Structure'/><title type='text'>Find minimum steps required</title><content type='html'>Given a 2-d space with origin (0,0); find in how many minimum steps can a knight reach to a point (x,y) from (0,0)? Is it possible to traverse to any such point in the space from (0,0) or we have some specific conditions on x, y for such a path to exist? Prove your arguments.&lt;br /&gt;&lt;br /&gt;Would your algorithm be still valid if traversing in x-axis direction is cheaper than traversing in y-axis direction or vice versa?&lt;br /&gt;&lt;br /&gt;PS: a knight walks 2 units in X-axis and 1 unit in Y-axis or 2 units in Y-axis and 1 unit in X-axis in one move.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8648827358021243487?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8648827358021243487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8648827358021243487&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8648827358021243487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8648827358021243487'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/find-minimum-steps-required.html' title='Find minimum steps required'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8988223932976329727</id><published>2008-03-28T17:26:00.003+05:30</published><updated>2008-04-01T23:12:16.975+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Some java fun !</title><content type='html'>What will be the output of this simple program?&lt;br /&gt;&lt;br /&gt;pretty simple, isn't it? :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class A&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;  public void f(Exception e)&lt;br /&gt;  {&lt;br /&gt;      System.out.println("A");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public static void main(String args[])&lt;br /&gt;  {&lt;br /&gt;      A a = new B();&lt;br /&gt;      a.f(new RuntimeException());&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  static class B extends A {&lt;br /&gt;&lt;br /&gt;      public void f(RuntimeException e)&lt;br /&gt;      {&lt;br /&gt;          System.out.println("B");&lt;br /&gt;      } &lt;br /&gt;   &lt;br /&gt;  }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8988223932976329727?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8988223932976329727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8988223932976329727&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8988223932976329727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8988223932976329727'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/some-java-fun.html' title='Some java fun !'/><author><name>Wanderlust</name><uri>http://www.blogger.com/profile/00612170956724528242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-1439034170346219440</id><published>2008-03-28T16:39:00.003+05:30</published><updated>2008-03-28T16:44:37.198+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>some more stupid array questions</title><content type='html'>1. an array has n/2 distinct elements and one element which is repeated n/2 times.. find out that element.. ofcourse.. in O(n)&lt;br /&gt;&lt;br /&gt;2. there is an array of size n. it has n-1 distinct elements, each of lying in the range from 1 to n.. find out the element that has been repeated once.. do that in O(1) extra space..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-1439034170346219440?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/1439034170346219440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=1439034170346219440&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1439034170346219440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1439034170346219440'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/some-more-stupid-array-questions.html' title='some more stupid array questions'/><author><name>Wanderlust</name><uri>http://www.blogger.com/profile/00612170956724528242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-4364840941558090539</id><published>2008-03-24T15:32:00.003+05:30</published><updated>2008-09-07T11:48:27.519+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linked Lists'/><title type='text'>a different doubly linked list</title><content type='html'>A doubly linked list is defined as follows:&lt;br /&gt;one link points to next neighbor and other link to any random node in the list.&lt;br /&gt;How will you generate clone , given a linked list which follows above definition?&lt;br /&gt;The list can be traversed only once.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-4364840941558090539?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/4364840941558090539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=4364840941558090539&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4364840941558090539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4364840941558090539'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/different-doubly-linked-list.html' title='a different doubly linked list'/><author><name>IamWhatIam</name><uri>http://www.blogger.com/profile/17509093444236094955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3826357371456976729</id><published>2008-03-19T14:54:00.003+05:30</published><updated>2008-09-07T11:47:30.189+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trees'/><title type='text'>largest common structurally similar sub tree</title><content type='html'>Given two trees as input, find the largest common structurally equivalent sub tree between the two trees. (The  largest common sub tree corresponds to the  common sub tree having the maximum number of total nodes ).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3826357371456976729?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3826357371456976729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3826357371456976729&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3826357371456976729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3826357371456976729'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/largest-common-structurally-similar-sub.html' title='largest common structurally similar sub tree'/><author><name>IamWhatIam</name><uri>http://www.blogger.com/profile/17509093444236094955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-4301866930228644965</id><published>2008-03-18T22:09:00.000+05:30</published><updated>2008-03-18T22:10:35.855+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bit Twiddling'/><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>Find two non repeated numbers</title><content type='html'>Given an array of size 2n+2 of which there are n pairs and remaining two are unique. How to find them in O(n) time and constant space.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-4301866930228644965?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/4301866930228644965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=4301866930228644965&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4301866930228644965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4301866930228644965'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/find-two-non-repeated-numbers.html' title='Find two non repeated numbers'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-748890814971365</id><published>2008-03-18T19:33:00.003+05:30</published><updated>2008-03-18T19:58:32.662+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>simple array qusetions</title><content type='html'>Two easy puzzles .. and my first post too.. baki uncles will be happy to see it finally ;)&lt;br /&gt;&lt;br /&gt;1. you have a sorted array. it has been rotated at an unknown index.. suggest an algorithm to find out an element from the rotated array... ex.. the array 561234 was made by rotating 123456 at the 4th index.. so how would you go about finding any number from the rotated array?&lt;br /&gt;&lt;br /&gt;2. you have an array of the form a0a1a2...anb0b1b2....bn . how will you convert it into a0b0a1b1..anbn?? use O(1) memory and ofcourse come up with an O(n) running time complexity solution&lt;br /&gt;&lt;br /&gt;3. an array has n/2 unique elements and one other element which has been repeated n/2 times... suggest different ways to find the repeated element.. O(n) solution can be achieved in multiple ways&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-748890814971365?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/748890814971365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=748890814971365&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/748890814971365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/748890814971365'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/simple-array-qusetions.html' title='simple array qusetions'/><author><name>Wanderlust</name><uri>http://www.blogger.com/profile/00612170956724528242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3289944119370483736</id><published>2008-03-17T12:13:00.003+05:30</published><updated>2008-09-07T11:48:02.738+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trees'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Structure'/><title type='text'>find nth max element in BST(Binary search tree)</title><content type='html'>Without using any extra space. Tree can be traversed only once.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3289944119370483736?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3289944119370483736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3289944119370483736&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3289944119370483736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3289944119370483736'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/find-nth-max-element-in-bstbinary.html' title='find nth max element in BST(Binary search tree)'/><author><name>IamWhatIam</name><uri>http://www.blogger.com/profile/17509093444236094955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2166881457062639434</id><published>2008-03-16T22:22:00.001+05:30</published><updated>2008-03-16T22:24:26.693+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data Structure'/><title type='text'>Find nth fibonacci number</title><content type='html'>Write an algo for finding nth fibonacci number.&lt;br /&gt;&lt;br /&gt;Hint: Recursive solution is not acceptable :D O(n) is obvious :D, We are talking about O(logn) solution :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2166881457062639434?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2166881457062639434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2166881457062639434&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2166881457062639434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2166881457062639434'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/find-nth-fibonacci-number.html' title='Find nth fibonacci number'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8696844040780954135</id><published>2008-03-13T20:44:00.002+05:30</published><updated>2008-03-13T20:52:31.311+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Common Puzzles'/><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>Randomized Shuffling Problem</title><content type='html'>How would you randomize an array of 52 values, from 0 to 51 with no repeats, such as you might want for a deck of cards? Prove that this really is random.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8696844040780954135?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8696844040780954135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8696844040780954135&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8696844040780954135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8696844040780954135'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/randomized-shuffling-problem.html' title='Randomized Shuffling Problem'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8387802140738121735</id><published>2008-03-13T12:53:00.000+05:30</published><updated>2008-03-13T12:54:03.412+05:30</updated><title type='text'>partition</title><content type='html'>Algorithm to partition set of numbers into two such that difference between their&lt;br /&gt;sum is min and they have equal number of elements&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8387802140738121735?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8387802140738121735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8387802140738121735&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8387802140738121735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8387802140738121735'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/partition.html' title='partition'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-1523422073821272956</id><published>2008-03-13T12:49:00.001+05:30</published><updated>2008-03-13T12:49:49.716+05:30</updated><title type='text'>median problem</title><content type='html'>you have n machines ,each having n integers.now u have to find the median of these n^2 numbers,but u can load only 2n integer at a time in memory.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-1523422073821272956?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/1523422073821272956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=1523422073821272956&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1523422073821272956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1523422073821272956'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/median-problem.html' title='median problem'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-5717190095619839228</id><published>2008-03-13T12:43:00.000+05:30</published><updated>2008-03-13T12:44:37.795+05:30</updated><title type='text'>Smallest subsequence</title><content type='html'>A file contains a sequence of charaters. Each character can be repeated any number of times in a file. Find a smallest subsequence which contains all the characters in the file atleast once.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-5717190095619839228?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/5717190095619839228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=5717190095619839228&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5717190095619839228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5717190095619839228'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/smallest-subsequence.html' title='Smallest subsequence'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-4583926094864305597</id><published>2008-03-13T12:41:00.001+05:30</published><updated>2008-03-13T12:42:59.485+05:30</updated><title type='text'>extra paranthesis</title><content type='html'>how to remove unnecessary brackets from the given expression, without creating any ambiguity.&lt;br /&gt;e.g. (1+2) * (3) .. this can be written as (1+2) * 3&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-4583926094864305597?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/4583926094864305597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=4583926094864305597&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4583926094864305597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4583926094864305597'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/extra-paranthesis.html' title='extra paranthesis'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-302562312637856938</id><published>2008-03-13T12:22:00.002+05:30</published><updated>2008-03-13T12:25:26.688+05:30</updated><title type='text'>Adobe face to face interviews</title><content type='html'>1. n/2 repeated numbers from n numbers, all the other numbers are distinct . Find tht no&lt;br /&gt;2. 3 containers .. take 1 ball frm 2 containers and place in the 3rd. repeat these steps such that finally all the balls are in 1 container (Hint: multiple of 3)&lt;br /&gt;3. implement cron job in java&lt;br /&gt;4. implement MRU cache data structure (Hint: LinkedHashSet)&lt;br /&gt;5. implement HashSet (rehashing ...improvements)&lt;br /&gt;6. JVM ... how does class data and methods are stored&lt;br /&gt;7. find a circle in a linked list ... i gave the answer tht we can take 2 pointers ... move 1 ptr by 1 dist and the other by 2 dist .. why not move the other ptr by 3 dist&lt;br /&gt;8. socket programming -- .. bind, connect, listen, accept, SELECT - when to use it ...&lt;br /&gt;9. composition and inhertitance&lt;br /&gt;8. n/w address translation table --- implement it&lt;br /&gt;9. general TCP questions&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-302562312637856938?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/302562312637856938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=302562312637856938&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/302562312637856938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/302562312637856938'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/adobe-face-to-face-interviews.html' title='Adobe face to face interviews'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-6155181148764784355</id><published>2008-03-11T10:03:00.004+05:30</published><updated>2008-03-11T10:12:17.283+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linked Lists'/><title type='text'>Merge point in two linked lists</title><content type='html'>Given two link list, find out do they merge ? if yes, find the merge point. What will you do if the link list have loop at the end ? What if the lists connect at an oval like shown below?&lt;br /&gt;&lt;br /&gt;&lt;div align=center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_EFR_q-YEW4U/R9YM9yeOJAI/AAAAAAAAAa8/fnv5cJX7lZU/s1600-h/untitled.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_EFR_q-YEW4U/R9YM9yeOJAI/AAAAAAAAAa8/fnv5cJX7lZU/s320/untitled.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5176339077369046018" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-6155181148764784355?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/6155181148764784355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=6155181148764784355&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/6155181148764784355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/6155181148764784355'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/merge-point-in-two-linked-lists.html' title='Merge point in two linked lists'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_EFR_q-YEW4U/R9YM9yeOJAI/AAAAAAAAAa8/fnv5cJX7lZU/s72-c/untitled.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8857100553362017766</id><published>2008-03-02T23:34:00.003+05:30</published><updated>2008-03-02T23:49:44.221+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='UNSOLVED'/><title type='text'>Find possible parenthesizing</title><content type='html'>Given an input n write a program to generate all possible parenthesizing.&lt;br /&gt;&lt;br /&gt;For ex: if n=3, then following is the result&lt;br /&gt;&lt;br /&gt;((()))&lt;br /&gt;(())()&lt;br /&gt;()()()&lt;br /&gt;(()())&lt;br /&gt;()(())&lt;br /&gt;&lt;br /&gt;Number of such elements is represented as Catalan Number. For more details, see http://en.wikipedia.org/wiki/Catalan_number&lt;br /&gt;&lt;br /&gt;A similar problem asks to find all possible permutations of given elements with following two variations:&lt;br /&gt;&lt;br /&gt;1. There might be repetitions&lt;br /&gt;2. All elements are unique&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8857100553362017766?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8857100553362017766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8857100553362017766&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8857100553362017766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8857100553362017766'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/find-possible-parenthesizing.html' title='Find possible parenthesizing'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8962189659867559798</id><published>2008-03-01T15:52:00.004+05:30</published><updated>2008-03-01T15:56:16.712+05:30</updated><title type='text'>Stack with findMin() in O(1) worst case</title><content type='html'>Implement a data structure which provides all stack operations in O(1)(e.g. push(), pop()) and also provides findMin() in O(1) in worst case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8962189659867559798?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8962189659867559798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8962189659867559798&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8962189659867559798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8962189659867559798'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/03/stack-with-findmin-in-o1-worst-case.html' title='Stack with findMin() in O(1) worst case'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-5533972838096407975</id><published>2008-02-26T14:07:00.002+05:30</published><updated>2008-09-07T11:52:09.110+05:30</updated><title type='text'>Difference b/w Collection and Collections</title><content type='html'>&lt;span class="hints"&gt;Collections provide you views (annoymous class instances) for read-only &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-5533972838096407975?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/5533972838096407975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=5533972838096407975&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5533972838096407975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5533972838096407975'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/difference-bw-collection-and.html' title='Difference b/w Collection and Collections'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8716758232859125478</id><published>2008-02-25T20:46:00.005+05:30</published><updated>2008-09-07T12:26:58.412+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Implementation of an efficient MRU Cache in Java</title><content type='html'>&lt;span&gt;LinkedHashMap with doubly linked list to keep the most recently accessed element at the head/tail of the list. Every bucket's list keeps its own elements in the singly linked list and the same elements are doubly linked as well&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8716758232859125478?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8716758232859125478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8716758232859125478&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8716758232859125478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8716758232859125478'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/implementation-of-efficient-mru-cache.html' title='Implementation of an efficient MRU Cache in Java'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8070190500782728973</id><published>2008-02-25T20:41:00.006+05:30</published><updated>2008-09-07T12:27:34.481+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Difference between Comparable and Comparator</title><content type='html'>&lt;span class="hints"&gt;Comparator implementations can be used to define custom sorting even for Objects which already implement Comparable interface in TreeSet, HashSet&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8070190500782728973?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8070190500782728973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8070190500782728973&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8070190500782728973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8070190500782728973'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/difference-between-comparable-and.html' title='Difference between Comparable and Comparator'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8382840898167321917</id><published>2008-02-23T00:32:00.006+05:30</published><updated>2008-09-07T12:28:07.769+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bit Twiddling'/><title type='text'>Find modulo (1 &lt;&lt; k) division without using division</title><content type='html'>&lt;span class="hints"&gt; m = n &amp; (d - 1); where d= (1 &lt;&lt; k)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8382840898167321917?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8382840898167321917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8382840898167321917&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8382840898167321917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8382840898167321917'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/find-modulo-k-division-without-using.html' title='Find modulo (1 &lt;&lt; k) division without using division'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2869229193749091572</id><published>2008-02-23T00:08:00.003+05:30</published><updated>2008-02-23T00:08:46.644+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bit Twiddling'/><title type='text'>Find if the given integer is even or odd</title><content type='html'>Use of division is not permissible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2869229193749091572?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2869229193749091572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2869229193749091572&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2869229193749091572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2869229193749091572'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/find-if-given-integer-is-even-or-odd.html' title='Find if the given integer is even or odd'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-7531066003660207450</id><published>2008-02-23T00:02:00.003+05:30</published><updated>2008-02-23T00:17:34.260+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bit Twiddling'/><title type='text'>Bit Twiddling</title><content type='html'>Find the minimum and maximum of two numbers without any branching. Prohibiting branching means (a&gt;b)?b:a is also prohibited.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-7531066003660207450?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/7531066003660207450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=7531066003660207450&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/7531066003660207450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/7531066003660207450'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/bit-twiddling.html' title='Bit Twiddling'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3344855495427781137</id><published>2008-02-22T21:04:00.002+05:30</published><updated>2008-02-22T21:08:14.135+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trees'/><category scheme='http://www.blogger.com/atom/ns#' term='Sorting'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Structure'/><title type='text'>Sorting for large data sizes</title><content type='html'>I have a computer file containing 1,000,000 non-negative integers, in no particular order. Imagine that they are the membership numbers of people who are enrolled in my internet club. A new person wants to join the club, and we need to find an unused number to allocate to them. How would you find, in a reasonable time, a number that was not already in the file?&lt;br /&gt;&lt;br /&gt;Hint: Use Selection trees for finding the first missing integer among those 1,000,000 integers. The in memory amount of data that we have to keep is very small.&lt;br /&gt;&lt;br /&gt;Reference: http://www.cse.ohio-state.edu/~gurari/course/cis680/cis680Ch6.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3344855495427781137?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3344855495427781137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3344855495427781137&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3344855495427781137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3344855495427781137'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/sorting-for-large-data-sizes.html' title='Sorting for large data sizes'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-5011094708198651437</id><published>2008-02-21T22:05:00.003+05:30</published><updated>2008-02-22T21:20:33.662+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Numeric Puzzles'/><title type='text'>Digits in a factorial</title><content type='html'>Find the "number of digits in the factorial of a number" without finding the factorial??&lt;br /&gt;&lt;br /&gt;Hint: Algorithm should not take more than O(lg N) where lg = log10&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-5011094708198651437?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/5011094708198651437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=5011094708198651437&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5011094708198651437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5011094708198651437'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/digits-in-factorial.html' title='Digits in a factorial'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-1532874863722175016</id><published>2008-02-18T21:19:00.006+05:30</published><updated>2008-02-22T21:20:52.081+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>1-0 array problem</title><content type='html'>Given an array A (n X n), which takes values from set {0, 1}; i.e.&lt;br /&gt;&lt;br /&gt;A[i][j]= 0 or 1 for all i,j between 0 and n&lt;br /&gt;&lt;br /&gt;Find a row i such that all elements in the row are 1s and a column j such that all elements are 0 except the intersecting element A[i][j] which is 1.&lt;br /&gt;&lt;br /&gt;Another version of the same problem goes like this:&lt;br /&gt;Given that every row of the array has all 1s and 0s together and 0s follow only after 1s in the row, find the maximum number of 1s in a row in the array.&lt;br /&gt;&lt;br /&gt;Hint: O(n2) is a naive algorithm and O(n) is nice.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-1532874863722175016?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/1532874863722175016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=1532874863722175016&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1532874863722175016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/1532874863722175016'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/1-0-array-problem.html' title='1-0 array problem'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8251104619574547715</id><published>2008-02-17T11:59:00.004+05:30</published><updated>2008-02-22T21:21:09.761+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>Finding repeated numbers in two arrays</title><content type='html'>&lt;p&gt;Given two sorted integer arrays (array size may differ).&lt;br /&gt;&lt;/p&gt;Find the number of values that appear in both arrays.&lt;br /&gt;&lt;br /&gt;For example, given:&lt;br /&gt;&lt;p&gt; A: 1, 3, 5, 8, 10. 14, 16, 25, 28, 47&lt;br /&gt;B: 2, 4, 7, 8, 11, 12, 14, 17, 47, 56, 64&lt;br /&gt;&lt;/p&gt;The result should be 3, since value 8, 14, 47 appear in both array.&lt;br /&gt;&lt;br /&gt;Hint: A simple approach would take O(m+n) however it can be done in O(nlogm) (a better bound if n is very small as compared to m)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8251104619574547715?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8251104619574547715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8251104619574547715&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8251104619574547715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8251104619574547715'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/finding-repeated-numbers-in-two-arrays.html' title='Finding repeated numbers in two arrays'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-4387293771448340988</id><published>2008-02-17T11:26:00.004+05:30</published><updated>2008-02-22T21:21:33.918+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Trees'/><category scheme='http://www.blogger.com/atom/ns#' term='Tries'/><category scheme='http://www.blogger.com/atom/ns#' term='Hashing'/><title type='text'>Blogs, Tagging and Summary Problem</title><content type='html'>(Originally mentioned by Ghai uncle, this is an extended problem of the same kind)&lt;br /&gt;&lt;br /&gt;A blogger just wrote a review on movie "Shivaji" starring Rajnikant and tagged it as "Rajnikant movie, Shivaji, movie review". For better surfing experience of the blogger, the blogging portal (your firm) wants to develop following features:&lt;br /&gt;&lt;br /&gt;1. The moment the blogger posts his review, he is shown a list of other reviews on this movie. (To make it simple, the list contains links to blogs from his friends only)&lt;br /&gt;&lt;br /&gt;2.  There is an option to list all such blogs in a page. The listing page contains a shortest summary from each link containing all the tags and the tags highlighted properly in different colors in the summary. So for example, "Rajnikant movie" will be colored red, "Shivaji" would be colored blue, "movie review" will be colored green in the summary; however "Rajnikant" merit no coloring and "shivaji movie" merit coloring of "shivaji" only and likewise.&lt;br /&gt;&lt;br /&gt;How would you do it?&lt;br /&gt;&lt;br /&gt;Hint: There are essentially three problems:&lt;br /&gt;1. finding blog links with similar tags.&lt;br /&gt;2. finding shortest summary of text from a document containing all the tags in it.&lt;br /&gt;3. finding out occurrences of a set of keywords/tags in a document.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-4387293771448340988?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/4387293771448340988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=4387293771448340988&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4387293771448340988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/4387293771448340988'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/blogs-tagging-and-summary-problem.html' title='Blogs, Tagging and Summary Problem'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-5326656403101086744</id><published>2008-02-09T19:12:00.006+05:30</published><updated>2008-04-05T16:29:46.827+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='Interview Questions'/><title type='text'>Adobe Written interview questions</title><content type='html'>1.  Write an algo to print all paths in a binary tree.&lt;br /&gt;2.  Write an algo to determine if 2 rectangles intersect.&lt;br /&gt;3.  If an identifier is defined as follows&lt;br /&gt;        letter followed any number of letters and digits then write its regular expression.&lt;br /&gt;4. x=b, z=1;k=n; // n is constant&lt;br /&gt;    while(k!=0)&lt;br /&gt;    {&lt;br /&gt;        if(k is odd) z=z*x;&lt;br /&gt;&lt;br /&gt;        x=x*x;&lt;br /&gt;        k=floor(k/2);&lt;br /&gt;    }&lt;br /&gt;    what is z at the end in terms of b and n?&lt;br /&gt;5. What is synchronized statement, synchronized function, transient, wait(), notify(),         notifyAll();&lt;br /&gt;6. String s = "Hello";&lt;br /&gt;    String t = s.append(" Dolly");&lt;br /&gt;    Which string do s and t point to ?&lt;br /&gt;7. What is advantage of entity beans over session beans?&lt;br /&gt;&lt;br /&gt;8. What are J2EE components?&lt;br /&gt;9. What is multi-tier architecture ? In which layer does browser fits in ?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-5326656403101086744?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/5326656403101086744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=5326656403101086744&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5326656403101086744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/5326656403101086744'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/02/adobe-written-interview-questions.html' title='Adobe Written interview questions'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-868688503345518575</id><published>2008-01-29T20:19:00.002+05:30</published><updated>2008-02-23T00:07:04.788+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bit Twiddling'/><category scheme='http://www.blogger.com/atom/ns#' term='Numeric Puzzles'/><title type='text'>Count the number of set bits in a byte/int32</title><content type='html'>Hint: there are atleast 7 solutions each with varying runtime complexities. Popular ones are O(no. of bits), O(no. of set bits), O(no. of unset bits)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-868688503345518575?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/868688503345518575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=868688503345518575&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/868688503345518575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/868688503345518575'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/01/count-number-of-set-bits-in-byteint32.html' title='Count the number of set bits in a byte/int32'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8243135476513173511</id><published>2008-01-29T20:17:00.001+05:30</published><updated>2008-02-22T21:22:45.153+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Coin Puzzles'/><title type='text'>10 coins, 1 lighter coin</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt; Out of 10 coins, one weighs less then the others. You have a scale. &lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li style="font-family: verdana;"&gt;&lt;span style="font-size:85%;"&gt; How can you determine which one weighs less in 3 weighs?  &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt; Now how would you do it if you didn't know if the odd coin weighs less or more?&lt;/span&gt;&lt;/span&gt; &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8243135476513173511?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8243135476513173511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8243135476513173511&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8243135476513173511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8243135476513173511'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/01/10-coins-1-lighter-coin.html' title='10 coins, 1 lighter coin'/><author><name>Matka/HTML</name><uri>http://www.blogger.com/profile/07326437678139019311</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-7471509770118623864</id><published>2008-01-24T19:39:00.001+05:30</published><updated>2008-02-22T21:22:58.918+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Coin Puzzles'/><title type='text'>Coins puzzle</title><content type='html'>There are infinite number of coins in a dark room with exactly 129 coins facing heads.You need to divide the coins into 2 parts such that number of coins facing heads are equal in the 2 parts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-7471509770118623864?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/7471509770118623864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=7471509770118623864&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/7471509770118623864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/7471509770118623864'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/01/coins-puzzle.html' title='Coins puzzle'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3226178784993354812</id><published>2008-01-18T11:35:00.001+05:30</published><updated>2008-02-22T21:23:16.180+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Common Puzzles'/><title type='text'>Puzzle Time: 2 egg problem</title><content type='html'>You have 2 eggs and a multi-storeyed building with you[:) ..yes the building is yours!]&lt;br /&gt;Tolerance level of an egg is defined as the minimum height from which dropping the egg would break it!In other words, if tolerance level of an egg is say 15 it means if the egg is dropped from floor no. &gt;= 15  it would break.&lt;br /&gt;Both the eggs have equal tolerance levels.&lt;br /&gt;What is the minimum number of attempts you need to correctly determine the tolerance level of the eggs. &lt;br /&gt;&lt;br /&gt;What if there are 3 eggs?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3226178784993354812?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3226178784993354812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3226178784993354812&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3226178784993354812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3226178784993354812'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/01/puzzle-time-2-egg-problem.html' title='Puzzle Time: 2 egg problem'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-8646606345854376064</id><published>2008-01-17T14:46:00.001+05:30</published><updated>2008-02-22T21:23:45.096+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linked Lists'/><title type='text'>Linked List</title><content type='html'>Find whether a circle exists in a Linked List. If yes then find the node where the circle begins. Can be done in O(n) time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-8646606345854376064?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/8646606345854376064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=8646606345854376064&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8646606345854376064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/8646606345854376064'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/01/linked-list.html' title='Linked List'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-2226579987062646477</id><published>2008-01-17T14:43:00.002+05:30</published><updated>2008-02-22T21:24:57.887+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>Repeated Number in an array</title><content type='html'>An array of length n+1 is given which is filled with the numbers 1... n such that only 1 number is repeated. Find the repeated number.&lt;br /&gt;&lt;br /&gt;Another variation of the problem asks to find repeated numbers if there are two such repetitions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-2226579987062646477?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/2226579987062646477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=2226579987062646477&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2226579987062646477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/2226579987062646477'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/01/repeated-number-in-array.html' title='Repeated Number in an array'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3801677831499796125</id><published>2008-01-17T14:39:00.001+05:30</published><updated>2008-02-22T21:25:23.669+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linked Lists'/><title type='text'>Linked List Intersection</title><content type='html'>Suppose you have 2 Singly Linked List that intersect at a Node.&lt;br /&gt;Find that node in O(n) time complexity and O(1)  space.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3801677831499796125?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3801677831499796125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3801677831499796125&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3801677831499796125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3801677831499796125'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/01/linked-list-intersection.html' title='Linked List Intersection'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7991884387761107092.post-3705690739579496116</id><published>2008-01-17T14:36:00.001+05:30</published><updated>2008-02-22T21:25:38.497+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Arrays'/><title type='text'>3 Array Problem</title><content type='html'>There are 3 unsorted arrays with negative and positive numbers. Find 3 numbers one from each array such that their sum total is 0.&lt;br /&gt;e.g. A, B, C are three arrays&lt;br /&gt;then A[i] + B[j] + C[k] = 0&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7991884387761107092-3705690739579496116?l=unclelog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://unclelog.blogspot.com/feeds/3705690739579496116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7991884387761107092&amp;postID=3705690739579496116&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3705690739579496116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7991884387761107092/posts/default/3705690739579496116'/><link rel='alternate' type='text/html' href='http://unclelog.blogspot.com/2008/01/3-array-problem.html' title='3 Array Problem'/><author><name>Nihit</name><uri>http://www.blogger.com/profile/01577307157001055418</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_RATc7lnbF6k/Sg5qWerBu0I/AAAAAAAAA3I/X71V3HmDXJo/S220/Photo+22.jpg'/></author><thr:total>0</thr:total></entry></feed>
