<?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-11601416</id><updated>2011-12-14T19:01:51.205-08:00</updated><title type='text'>Every Thing that Happens is for Good !!!</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://frustooo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://frustooo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Amal</name><uri>http://www.blogger.com/profile/12230571316208451862</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>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-11601416.post-113636759890367653</id><published>2006-01-04T01:34:00.000-08:00</published><updated>2006-01-04T01:52:00.193-08:00</updated><title type='text'>Diameter of a Tree</title><content type='html'>This is a *ed problem in CLR (Algo Text Book).&lt;br /&gt;Diameter of a tree is defined as the longest of all the shortest distances between any pair of nodes of the tree. &lt;br /&gt;&lt;br /&gt; The Algorithm for finding the Diameter is.&lt;br /&gt; 1) Take any node and apply BFS.&lt;br /&gt; 2) Find the node that is farthest from the starting node.&lt;br /&gt; 3) Apply DFS with the farthest node as the starting node.&lt;br /&gt;&lt;br /&gt; This will give the Diameter of the tree.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11601416-113636759890367653?l=frustooo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frustooo.blogspot.com/feeds/113636759890367653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11601416&amp;postID=113636759890367653' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113636759890367653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113636759890367653'/><link rel='alternate' type='text/html' href='http://frustooo.blogspot.com/2006/01/diameter-of-tree.html' title='Diameter of a Tree'/><author><name>Amal</name><uri>http://www.blogger.com/profile/12230571316208451862</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>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11601416.post-113311933962978031</id><published>2005-11-27T11:20:00.000-08:00</published><updated>2005-11-27T11:22:19.640-08:00</updated><title type='text'>More Bit Manipulations !!!</title><content type='html'>This Page contains really good bit manipulations. You will really start appreciating the magic of bit manipulations after going over the algos in this Page.&lt;br /&gt;&lt;br /&gt; &lt;a href="http://aggregate.org/MAGIC/"&gt; http://aggregate.org/MAGIC/ &lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Happy reading.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11601416-113311933962978031?l=frustooo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frustooo.blogspot.com/feeds/113311933962978031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11601416&amp;postID=113311933962978031' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113311933962978031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113311933962978031'/><link rel='alternate' type='text/html' href='http://frustooo.blogspot.com/2005/11/more-bit-manipulations.html' title='More Bit Manipulations !!!'/><author><name>Amal</name><uri>http://www.blogger.com/profile/12230571316208451862</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>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-11601416.post-113311575492257800</id><published>2005-11-26T00:16:00.000-08:00</published><updated>2005-11-27T10:23:55.276-08:00</updated><title type='text'>Snoob</title><content type='html'>This function calculates the next highest number with the same number of bits. Below is the source code of the function which I got from the site &lt;a href=http://tykje.com/talk/&gt;http://tykje.com/talk/ &lt;/a&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;unsigned snoob(unsigned x) {&lt;br /&gt;   unsigned smallest, ripple, ones;&lt;br /&gt;                                // x = xxx0 1111 0000&lt;br /&gt;   smallest = x &amp; -x;           //     0000 0001 0000&lt;br /&gt;   ripple = x + smallest;       //     xxx1 0000 0000&lt;br /&gt;   ones = x ^ ripple;           //     0001 1111 0000&lt;br /&gt;   ones = (ones &gt;&gt; 2)/smallest; //     0000 0000 0111&lt;br /&gt;   return ripple | ones;        //     xxx1 0000 0111&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Wonderful function this is.I have started admiring what bit manipulations can do.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11601416-113311575492257800?l=frustooo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frustooo.blogspot.com/feeds/113311575492257800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11601416&amp;postID=113311575492257800' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113311575492257800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113311575492257800'/><link rel='alternate' type='text/html' href='http://frustooo.blogspot.com/2005/11/snoob.html' title='Snoob'/><author><name>Amal</name><uri>http://www.blogger.com/profile/12230571316208451862</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-11601416.post-113295000558503650</id><published>2005-11-25T12:05:00.000-08:00</published><updated>2005-11-25T19:56:27.956-08:00</updated><title type='text'>next_permutation !!!</title><content type='html'>STL provides a simple and a very useful function called next_permutation which takes a sequence and generates permutation in a lexicographical order. This function does not even generate repeated permutations when some of the elements of the sequence are repeated. So this makes it much more useful. Suppose we write a normal recursive function for generating permutations we have to take special care of the repeating characters. &lt;br /&gt;&lt;br /&gt; Following is the algo for the next permutation.&lt;br /&gt; Consider a permutation a1,a2,a3,... an.&lt;br /&gt; find a pointer i such a(i)&lt; a(i+1). Once u find this pointer i , repeat again from the right end of the array to find a value &amp;gt= a(i). Let this value pointed by the pointer j.&lt;br /&gt;Now swap (a(i) , a(j)) and then reverse array from a(i+1) to a(n).&lt;br /&gt;This permutation will be the next permutation. The order of this Algo is O(n) where n is the number of elements of the array. The condition a(i) &lt; a(i+1) is responsible for non repetition of permutations when a element occurs more than once in the array.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11601416-113295000558503650?l=frustooo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frustooo.blogspot.com/feeds/113295000558503650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11601416&amp;postID=113295000558503650' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113295000558503650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113295000558503650'/><link rel='alternate' type='text/html' href='http://frustooo.blogspot.com/2005/11/nextpermutation.html' title='next_permutation !!!'/><author><name>Amal</name><uri>http://www.blogger.com/profile/12230571316208451862</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-11601416.post-113294113580644630</id><published>2005-11-25T09:47:00.000-08:00</published><updated>2005-11-25T09:52:15.820-08:00</updated><title type='text'>Absolute value of a floating point number.</title><content type='html'>Simplest way,&lt;br /&gt;    a = a&gt;0?a:-a; where a is the floating point nnumber.&lt;br /&gt;&lt;br /&gt; But if we notice the way the floating point numbers are stored in a system using IEEE format... Then we will find that a separate bit is assigned for the sign of this number. Now this sign bit is  0 for positive numbers and 1 for negative numbers. So Just manipulating this bit will give the absolute value of a floating point number.&lt;br /&gt;&lt;br /&gt;   *((int*)&amp;a) &amp;= 0x7fffffff;&lt;br /&gt;will do the same as the above mentioned method. Now how will you find the absolute value of a Double precision floating point number ?? :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11601416-113294113580644630?l=frustooo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frustooo.blogspot.com/feeds/113294113580644630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11601416&amp;postID=113294113580644630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113294113580644630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113294113580644630'/><link rel='alternate' type='text/html' href='http://frustooo.blogspot.com/2005/11/absolute-value-of-floating-point.html' title='Absolute value of a floating point number.'/><author><name>Amal</name><uri>http://www.blogger.com/profile/12230571316208451862</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-11601416.post-113222100709000469</id><published>2005-11-17T01:40:00.000-08:00</published><updated>2005-11-25T01:50:45.226-08:00</updated><title type='text'>Diff Algorithm!!!</title><content type='html'>I use diff a lot for many sorts of stuff.... But I never thought about what the algorithm for the diff util could be. I came to know that Diff uses LCS (Longest common subsequence) Algorithm. Still want to learn how they have efficiently implemented matching lines  for the algo.&lt;br /&gt;&lt;br /&gt;So iam trying to see through the Diff source code. Will update this post once I have done with the Diff source code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11601416-113222100709000469?l=frustooo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frustooo.blogspot.com/feeds/113222100709000469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=11601416&amp;postID=113222100709000469' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113222100709000469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113222100709000469'/><link rel='alternate' type='text/html' href='http://frustooo.blogspot.com/2005/11/diff-algorithm.html' title='Diff Algorithm!!!'/><author><name>Amal</name><uri>http://www.blogger.com/profile/12230571316208451862</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-11601416.post-113213134482825955</id><published>2005-11-16T00:42:00.000-08:00</published><updated>2005-11-25T09:19:21.416-08:00</updated><title type='text'>Hello World !!</title><content type='html'>This is my first blog. :) . Most probably will be a technical one . Just to remember all that I have learnt and all that I would like to learn.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11601416-113213134482825955?l=frustooo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113213134482825955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11601416/posts/default/113213134482825955'/><link rel='alternate' type='text/html' href='http://frustooo.blogspot.com/2005/11/hello-world.html' title='Hello World !!'/><author><name>Amal</name><uri>http://www.blogger.com/profile/12230571316208451862</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></entry></feed>
