<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>GeeksforGeeks &#187; Recent Posts</title>
		<link>http://geeksforgeeks.org/forum/</link>
		<description>Coming together of Geeks</description>
		<language>en-US</language>
		<pubDate>Tue, 07 Feb 2012 02:25:51 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://geeksforgeeks.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://geeksforgeeks.org/forum/rss/" rel="self" type="application/rss+xml" />

		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer (Fresher) about Algorithms"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-fresher-about-algorithms-29#post-36409</link>
			<pubDate>Tue, 07 Feb 2012 00:30:37 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36409@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Use hash - as we are dealing with alphabetic letters. &#60;/p&#62;
&#60;p&#62;Hash the input word character by character.&#60;/p&#62;
&#60;p&#62;Use each words in the linked list and compare with the input word using hash table.&#60;/p&#62;
&#60;p&#62;If they matches - It is the anagram. Otherwise not.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>abzx12@gmail.com on "data structures : amazon"</title>
			<link>http://geeksforgeeks.org/forum/topic/data-structures-amazon#post-36408</link>
			<pubDate>Mon, 06 Feb 2012 21:43:42 +0000</pubDate>
			<dc:creator>abzx12@gmail.com</dc:creator>
			<guid isPermaLink="false">36408@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Given numbers 1 to 1000, suggest a data structure to store them such that following operations can be executed in constant time:&#60;br /&#62;
1- insertion,&#60;br /&#62;
2- deletion,&#60;br /&#62;
3- searching,&#60;br /&#62;
4- get_any_number (means return any number if present in the data-structure otherwise return -1).&#60;/p&#62;
&#60;p&#62;NOTE: Numbers are unique in the data structure.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer about Algorithms"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-algorithms-90#post-36407</link>
			<pubDate>Mon, 06 Feb 2012 20:51:30 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36407@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Use trie.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer about Arrays"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-arrays-37#post-36406</link>
			<pubDate>Mon, 06 Feb 2012 20:37:18 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36406@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Is it subset or the whole 1D array?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer about Linked Lists"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-linked-lists-12#post-36405</link>
			<pubDate>Mon, 06 Feb 2012 20:31:56 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36405@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;&#60;a href=&#34;http://www.geeksforgeeks.org/archives/7740&#34; rel=&#34;nofollow&#34;&#62;http://www.geeksforgeeks.org/archives/7740&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer about Data Structure"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-data-structure-18#post-36404</link>
			<pubDate>Mon, 06 Feb 2012 20:22:33 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36404@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;I think Here Instant search means &#34;Fetching results&#34;&#60;/p&#62;
&#60;p&#62;It can be implemented using Trie .
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "How to find out the position of a msb in a number?"</title>
			<link>http://geeksforgeeks.org/forum/topic/how-to-find-out-the-position-of-a-msb-in-a-number#post-36403</link>
			<pubDate>Mon, 06 Feb 2012 19:16:13 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36403@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Running time as faster as you can. Logarithmic time expected !!&#60;/p&#62;
&#60;p&#62;Do not use in built log function or __builtin_clz
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Largest Palindrome in a string"</title>
			<link>http://geeksforgeeks.org/forum/topic/largest-palindrome-in-a-string/page/2#post-36402</link>
			<pubDate>Mon, 06 Feb 2012 17:37:36 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36402@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;pre&#62;int longestPalindromSubSeq (char* str) {
  int **seqMatrix, i, j, s ;
  int len = strlen(str) , seqlen;

  seqMatrix = (int **) malloc (sizeof(int*) * len) ;
  for (i = 0 ; i &#38;lt; len ; i ++ ) {
    *(seqMatrix+i) = (int *) malloc (sizeof(int) * len) ;
  }

  for (i = 0 ; i &#38;lt; len; i ++) {
    for (j = 0 ; j &#38;lt; len ; j ++) {
       /*(Each character is a palindrome of length 1)*/
        if (i == j)
            seqMatrix[i][i] = 1 ;
        else seqMatrix[i][j] = 0 ;
    }
  }

  for (i = 1 ; i &#38;lt; len ; i ++ ) {
    for ( s = 0 ; s &#38;lt; len-i ; s ++ ) {
      j = s+i ;
      seqMatrix[s][j] = computeCost (seqMatrix,str,s,j) ;
      seqMatrix[j][s] = seqMatrix[s][j];
    }
  }
  seqlen = seqMatrix[0][len-1] ;

  free (seqMatrix) ;
  return seqlen ;
}

int computeCost (int **seqMatrix, char* seq, int i, int j) {
  if (i == j)
    return seqMatrix[i][j] ;
  if (seq[i] == seq[j]) {
    if ((j-i)&#38;lt;=1)
      return j-i ;
    else return (seqMatrix[i+1][j-1] + 2) ;
  }
  return (seqMatrix[i+1][j]&#38;gt;seqMatrix[i][j-1]) ? seqMatrix[i+1][j] : seqMatrix[i][j-1];
}&#60;/pre&#62;</description>
		</item>
		<item>
			<title>kartik on "Tree Helical order traversal"</title>
			<link>http://geeksforgeeks.org/forum/topic/tree-helical-order-traversal#post-36401</link>
			<pubDate>Mon, 06 Feb 2012 16:34:38 +0000</pubDate>
			<dc:creator>kartik</dc:creator>
			<guid isPermaLink="false">36401@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;See &#60;a href=&#34;http://www.geeksforgeeks.org/archives/3758&#34; rel=&#34;nofollow&#34;&#62;http://www.geeksforgeeks.org/archives/3758&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>anji.swe on "Tree Helical order traversal"</title>
			<link>http://geeksforgeeks.org/forum/topic/tree-helical-order-traversal#post-36400</link>
			<pubDate>Mon, 06 Feb 2012 16:24:40 +0000</pubDate>
			<dc:creator>anji.swe</dc:creator>
			<guid isPermaLink="false">36400@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Any body, give a program / logic to traverse a tree in helical order&#60;/p&#62;
&#60;p&#62;ex:&#60;br /&#62;
tree:&#60;br /&#62;
                                                  1&#60;br /&#62;
                                         2                     3&#60;br /&#62;
                                     4     5              6    7 &#60;/p&#62;
&#60;p&#62;Out Put:&#60;br /&#62;
1 2 3 7 6 5 4 or 1 3 2  4 5 6 7
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer about Arrays"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-arrays-39#post-36399</link>
			<pubDate>Mon, 06 Feb 2012 16:13:06 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36399@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;An O(k) solution can look at only k elements smaller than x, plus at most O(k)&#60;br /&#62;
elements greater than x. Consider the following recursive procedure, called at the&#60;br /&#62;
root with i = 1 with count = k:&#60;/p&#62;
&#60;pre&#62;
int heap_compare(priority_queue *q, int k, int count, int x) {
  if ((count &#38;lt;= 0) &#124;&#124; (k &#38;gt; q-&#38;gt;n) return(count);
  if (q-&#38;gt;q[k] &#38;lt; x) {
    count = heap_compare(q, pq_young_child(k), count-1, x);
    count = heap_compare(q, pq_young_child(k)+1, count, x);
  }
  return(count);
}
&#60;/pre&#62;
&#60;p&#62;If the root of the min-heap is ≥ x, then no elements in the heap can be less than&#60;br /&#62;
x, as by definition the root must be the smallest element. This procedure searches&#60;br /&#62;
the children of all nodes of weight smaller than x until either (a) we have found&#60;br /&#62;
k of them, when it returns 0, or (b) they are exhausted, when it returns a value&#60;br /&#62;
greater than zero. Thus it will find enough small elements if they exist.&#60;/p&#62;
&#60;p&#62;&#60;em&#62;But how long does it take? The only nodes whose children we look at are those&#60;br /&#62;
&#38;lt; x, and at most k of these in total. Each have at most visited two children, so we&#60;br /&#62;
visit at most 3k nodes, for a total time of O(k).&#60;/em&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer about Arrays"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-arrays-39#post-36398</link>
			<pubDate>Mon, 06 Feb 2012 15:21:32 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36398@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;pre&#62;&#60;strong&#62;QuickSelect: &#60;/strong&#62; Given array A of size n and integer k ≤ n,
1. Pick a pivot element p at random from A.
2. Split A into subarrays LESS  and  GREATER by comparing each
    element to p as in Quicksort. While we are at it, count the number
    L of elements going in to LESS.
3. (a) If L = k − 1, then output p.
    (b) If L &#38;gt; k − 1, output QuickSelect(LESS, k).
    (c) If L &#38;lt; k − 1, output QuickSelect(GREATER, k − L − 1)
&#60;/pre&#62;
&#60;p&#62;&#60;strong&#62; The expected number of comparisons for QuickSelect is O(n)&#60;/strong&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Abhijeet Deshpande on "Precedence"</title>
			<link>http://geeksforgeeks.org/forum/topic/precedence-1#post-36397</link>
			<pubDate>Mon, 06 Feb 2012 15:17:06 +0000</pubDate>
			<dc:creator>Abhijeet Deshpande</dc:creator>
			<guid isPermaLink="false">36397@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;[EDIT]&#60;br /&#62;
&#60;strike&#62;&#60;br /&#62;
Just to be clear. the original C expression has nothing to do with sequence points. As pointed out by Venki, ++ and () fall under same precendence. Hence, they are evaluated from left to right. First the value held in b is incremented. Then it is assigned to b. After which (a-b) is evaluated with new value of b.&#60;/strike&#62;&#60;/p&#62;
&#60;p&#62;I am sorry I gave a wrong comment. Even the original code has sequence point violation. I was under the assumption that the binary operation &#34;+&#34; is a sequence point. However, it is not!!!&#60;/p&#62;
&#60;p&#62;However, the expressions posted by k53 later indeed have sequence point violations. The result is unpredictable.&#60;/p&#62;
&#60;p&#62;No offense, but do not refer to wikipedia for C fundamentals (or fundamentals of any subject, for that matter) :-) Refer to compiler datasheets (like MSDN) or standard textbooks instead
&#60;/p&#62;</description>
		</item>
		<item>
			<title>javanetbeans on "Amazon Banglore Online Written"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-banglore-online-written-3#post-36396</link>
			<pubDate>Mon, 06 Feb 2012 15:14:37 +0000</pubDate>
			<dc:creator>javanetbeans</dc:creator>
			<guid isPermaLink="false">36396@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;#include &#38;lt;iostream&#38;gt;&#60;br /&#62;
#include &#38;lt;vector&#38;gt;&#60;br /&#62;
using namespace std;&#60;/p&#62;
&#60;p&#62;vector&#38;lt;int&#38;gt; values;&#60;/p&#62;
&#60;p&#62;void printNodeAtDistance(node *root, int distance) {&#60;br /&#62;
    if (root == NULL) return;&#60;br /&#62;
    if (distance == 0) {&#60;br /&#62;
       values.push_back(root-&#38;gt;val);&#60;br /&#62;
    } else {&#60;br /&#62;
       printNodeAtDistance(root-&#38;gt;left, distance-1);&#60;br /&#62;
       printNodeAtDistance(root-&#38;gt;right, distance-1);&#60;br /&#62;
    }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;int getLen(node *move, node *desired, int k) {&#60;br /&#62;
    if (move == NULL) return -10;&#60;br /&#62;
    if (move-&#38;gt;val == desired-&#38;gt;val) {&#60;br /&#62;
       printNodeAtDistance(move, k);&#60;br /&#62;
       return k-1;&#60;br /&#62;
    }&#60;br /&#62;
    int p = getLen(move-&#38;gt;left, desired, k);&#60;br /&#62;
    if (p == -10) {&#60;br /&#62;
        p = getLen(move-&#38;gt;right, desired, k);&#60;br /&#62;
        if (p == 0){&#60;br /&#62;
              values.push_back(move-&#38;gt;val);&#60;br /&#62;
              return -10;&#60;br /&#62;
        }&#60;br /&#62;
        if (p == -10) return -10;&#60;br /&#62;
        printNodeAtDistance(move-&#38;gt;left, p-1);&#60;br /&#62;
    } else if (p &#38;gt;= 0) {&#60;br /&#62;
        if (p == 0){&#60;br /&#62;
             values.push_back(move-&#38;gt;val);&#60;br /&#62;
             return -10;&#60;br /&#62;
        }&#60;br /&#62;
        printNodeAtDistance(move-&#38;gt;right, p-1);&#60;br /&#62;
    }&#60;br /&#62;
    return p-1;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void printValues() {&#60;br /&#62;
    sort(values.begin(), values.end());&#60;br /&#62;
    for(int j = 0; j &#38;lt; values.size(); j++){&#60;br /&#62;
        cout &#38;lt;&#38;lt; values[j] &#38;lt;&#38;lt; endl;&#60;br /&#62;
    }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void printKDistanceNodes(node *root, node *start, int K){&#60;br /&#62;
    getLen(root, start, K);&#60;br /&#62;
    printValues();&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;int main()&#60;br /&#62;
{&#60;br /&#62;
    printKDistanceNodes(tree_pointer, start_pointer, K);&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer (0 - 2 Years) about Algorithms"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-0-2-years-about-algorithms-17#post-36395</link>
			<pubDate>Mon, 06 Feb 2012 13:22:24 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36395@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;@Narendra Kangralkar : Your code is correct but it is for finding only set-bit count for one number. But the question is different.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer about Algorithms"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-algorithms-92#post-36394</link>
			<pubDate>Mon, 06 Feb 2012 13:10:09 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36394@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;pre&#62;
int getDepthNoRecursion(node *root) {
  int depth = 0;
  int currDepth ;
  Stack *s ;
  node *temp ;
  if(root == NULL) {
    return 0;
  }
  root-&#38;gt;depth = 1;
  createStack (&#38;amp;s) ;
  push(&#38;amp;s,root);

  while(!isEmpty(s)) {
    temp = pop(&#38;amp;s);
    curDepth = temp-&#38;gt;depth;
    if(currDepth &#38;gt; depth) {
      depth = currDepth;
    }
    if(temp-&#38;gt;left ) {
      temp-&#38;gt;left-&#38;gt;depth = currDepth + 1;
      push(&#38;amp;s, temp-&#38;gt;left);
    }
    if(temp-&#38;gt;right) {
      temp-&#38;gt;right-&#38;gt;depth = currDepth + 1;
      push(&#38;amp;s, temp-&#38;gt;right);
    }
  }
  return depth;
}
typedef struct node {
  node *left;
  node *right;
  int val;
  int depth = 0;
}&#60;/pre&#62;</description>
		</item>
		<item>
			<title>kartik on "Amazon placement"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-placement#post-36392</link>
			<pubDate>Mon, 06 Feb 2012 04:20:57 +0000</pubDate>
			<dc:creator>kartik</dc:creator>
			<guid isPermaLink="false">36392@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;See &#60;a href=&#34;http://www.geeksforgeeks.org/archives/1155&#34; rel=&#34;nofollow&#34;&#62;http://www.geeksforgeeks.org/archives/1155&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>saurabhgeek on "Amazon placement"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-placement#post-36391</link>
			<pubDate>Mon, 06 Feb 2012 03:08:48 +0000</pubDate>
			<dc:creator>saurabhgeek</dc:creator>
			<guid isPermaLink="false">36391@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;You are given a linked list. Apart from the normal &#34;Next&#34; pointer, there is one more pointer(random ptr) in each node which points to some random node of the list. How will you create a clone of such a list? (In less than O(n^2))
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer (0 - 2 Years)"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-0-2-years-7#post-36390</link>
			<pubDate>Sun, 05 Feb 2012 21:57:41 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36390@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Create an array of 26 which holds the count of each small letters&#60;br /&#62;
And create another an array of 26 which holds the count of each Capital numbers.&#60;/p&#62;
&#60;pre&#62;
For each line from the text
  Initialize the arrays with all  0 s
  Extract each letter and check whether it is an alphabet or not.
  If letter is an alphabet
    increase the counter of arr[character] depending upon whether it is small or Capital letter.
    in each letter check the max count
    if count &#38;gt; max_count
       max_count = count 

 when all the letters in the line are scanned find all the characters with max_count and print it.
&#60;/pre&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer (Fresher) about Arrays"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-fresher-about-arrays-9#post-36389</link>
			<pubDate>Sun, 05 Feb 2012 20:08:19 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36389@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;@APJ : Your solution is quite nice.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer (Fresher) about Trees"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-fresher-about-trees-12#post-36388</link>
			<pubDate>Sun, 05 Feb 2012 18:14:44 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36388@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;&#60;strong&#62;I think symmetric means comparing the structure of left sub-tree with the right sub-tree.&#60;/strong&#62;&#60;/p&#62;
&#60;pre&#62;int isSymmetric (node *list1, node *list2) {
  int check1, check2 ;
  if (list1 == NULL &#38;amp;&#38;amp; list2 == NULL)
    return 1 ;
  if (list1 &#38;amp;&#38;amp; list2) {
    check1 = isSymmetric (list1-&#38;gt;left, list2-&#38;gt;right) ;
    check2 = isSymmetric (list1-&#38;gt;right, list2-&#38;gt;left) ;
    return check1 &#38;amp;&#38;amp; check2 ;
  }
  return 0 ;
}
&#60;/pre&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer (Fresher) about Algorithms, Arrays"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-fresher-about-algorithms-arrays-4#post-36387</link>
			<pubDate>Sun, 05 Feb 2012 17:47:02 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36387@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;&#60;a href=&#34;http://www.geeksforgeeks.org/archives/13209&#34; rel=&#34;nofollow&#34;&#62;http://www.geeksforgeeks.org/archives/13209&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Nice Solution..&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Time Complexity: O(n^2)&#60;/strong&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer (0 - 2 Years)"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-0-2-years-10#post-36386</link>
			<pubDate>Sun, 05 Feb 2012 17:30:39 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36386@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;&#60;a href=&#34;http://www.geeksforgeeks.org/archives/9755&#34; rel=&#34;nofollow&#34;&#62;http://www.geeksforgeeks.org/archives/9755&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Find duplicates in O(n) time and O(1) extra space&#60;/strong&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>agrawal25 on "Permutations of a string without repeatition"</title>
			<link>http://geeksforgeeks.org/forum/topic/permutations-of-a-string-without-repeatition#post-36385</link>
			<pubDate>Sun, 05 Feb 2012 17:09:47 +0000</pubDate>
			<dc:creator>agrawal25</dc:creator>
			<guid isPermaLink="false">36385@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;# include &#38;lt;iostream&#38;gt;&#60;br /&#62;
# include &#38;lt;string&#38;gt;&#60;/p&#62;
&#60;p&#62;using namespace std;&#60;/p&#62;
&#60;p&#62;int count=0;&#60;br /&#62;
void permun(string s1, string s2){&#60;br /&#62;
         int n=s2.size();&#60;br /&#62;
         if(s2.size()==2){&#60;br /&#62;
                          cout&#38;lt;&#38;lt;s1&#38;lt;&#38;lt;s2[0]&#38;lt;&#38;lt;s2[1]&#38;lt;&#38;lt;endl;&#60;br /&#62;
                          cout&#38;lt;&#38;lt;s1&#38;lt;&#38;lt;s2[1]&#38;lt;&#38;lt;s2[0]&#38;lt;&#38;lt;endl;&#60;br /&#62;
                          ::count+=2;&#60;br /&#62;
                          }&#60;br /&#62;
                          else{&#60;br /&#62;
                           for(int i=0; i&#38;lt;n; i++){&#60;br /&#62;
                               int x;&#60;br /&#62;
                               x=s2.find(s2[i]);&#60;br /&#62;
                               string s, s3;&#60;br /&#62;
                               s=s2;&#60;br /&#62;
                               s3=s.erase(x, 1);&#60;br /&#62;
                               permun(s1+s2[i], s3);&#60;br /&#62;
                         }&#60;br /&#62;
                         }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;int main(){&#60;br /&#62;
    string str;&#60;br /&#62;
    cin&#38;gt;&#38;gt;str;&#60;br /&#62;
    sort(str.begin(), str.end());&#60;br /&#62;
    string fxd;&#60;br /&#62;
    fxd= &#34;&#34;;&#60;/p&#62;
&#60;p&#62;  permun(fxd, str);&#60;br /&#62;
    cout&#38;lt;&#38;lt;::count&#38;lt;&#38;lt;endl;&#60;br /&#62;
    system(&#34;pause&#34;);&#60;br /&#62;
    return 0;&#60;br /&#62;
     }
&#60;/p&#62;</description>
		</item>
		<item>
			<title>agrawal25 on "Microsoft Interview Question for Software Engineer/Developer (Fresher) about Strings"</title>
			<link>http://geeksforgeeks.org/forum/topic/microsoft-interview-question-for-software-engineerdeveloper-fresher-about-strings-8#post-36384</link>
			<pubDate>Sun, 05 Feb 2012 17:06:04 +0000</pubDate>
			<dc:creator>agrawal25</dc:creator>
			<guid isPermaLink="false">36384@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;# include &#38;lt;iostream&#38;gt;&#60;br /&#62;
# include &#38;lt;string&#38;gt;&#60;/p&#62;
&#60;p&#62;using namespace std;&#60;/p&#62;
&#60;p&#62;int main(){&#60;br /&#62;
      string s=&#34;1AF&#34;;&#60;br /&#62;
    int y=0;&#60;br /&#62;
   for(int i =0; i&#38;lt;s.size(); i++){&#60;br /&#62;
           y*=16;&#60;br /&#62;
           if(s[i]&#38;gt;='0' &#38;amp;&#38;amp; s[i]&#38;lt;='9')&#60;br /&#62;
           y+=(int)s[i]-48;&#60;br /&#62;
           if(s[i]&#38;gt;='A' &#38;amp;&#38;amp; s[i]&#38;lt;='F')&#60;br /&#62;
           y+=(int)s[i]-55;&#60;br /&#62;
           if(s[i]&#38;gt;='a' &#38;amp;&#38;amp; s[i]&#38;lt;='f')&#60;br /&#62;
           y+=(int)s[i]-87;&#60;br /&#62;
           }&#60;br /&#62;
           cout&#38;lt;&#38;lt;y&#38;lt;&#38;lt;endl;&#60;/p&#62;
&#60;p&#62;    system(&#34;pause&#34;);&#60;br /&#62;
    return 0;&#60;br /&#62;
    }
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mukuljain.dtu on "Amazon online written test @ DCE"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-online-written-test-dce#post-36383</link>
			<pubDate>Sun, 05 Feb 2012 08:53:57 +0000</pubDate>
			<dc:creator>mukuljain.dtu</dc:creator>
			<guid isPermaLink="false">36383@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;1. Write a function isValid(int sudoko[][]) to chec whether a given sudoko solution is valid or not.&#60;/p&#62;
&#60;p&#62;2. You are given a paragraph in which the length of all the words in a line has following properties:&#60;br /&#62;
        odd position words are in increasing order of their length&#60;br /&#62;
        even position words are in decreasing order of their length&#60;br /&#62;
    you are given a word, you have to write a code to search it in the given paragraph and return the line&#60;br /&#62;
    number.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer (0 - 2 Years) about Trees"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-0-2-years-about-trees-2#post-36382</link>
			<pubDate>Sun, 05 Feb 2012 02:21:23 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36382@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;&#60;a href=&#34;http://www.geeksforgeeks.org/archives/10379&#34; rel=&#34;nofollow&#34;&#62;http://www.geeksforgeeks.org/archives/10379&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dee on "Google Interview Question for Software Engineer/Developer (Fresher) about Algorithms"</title>
			<link>http://geeksforgeeks.org/forum/topic/google-interview-question-for-software-engineerdeveloper-fresher-about-algorithms-15#post-36381</link>
			<pubDate>Sun, 05 Feb 2012 02:17:13 +0000</pubDate>
			<dc:creator>dee</dc:creator>
			<guid isPermaLink="false">36381@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;This might help understand the time complexity better &#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://stackoverflow.com/questions/2582732/time-complexity-of-sieve-of-eratosthenes-algorithm&#34; rel=&#34;nofollow&#34;&#62;http://stackoverflow.com/questions/2582732/time-complexity-of-sieve-of-eratosthenes-algorithm&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>kasireddi on "Binar Tree to Double Linked List (circular) Conversion"</title>
			<link>http://geeksforgeeks.org/forum/topic/binar-tree-to-double-linked-list-circular-conversion#post-36379</link>
			<pubDate>Sat, 04 Feb 2012 17:22:54 +0000</pubDate>
			<dc:creator>kasireddi</dc:creator>
			<guid isPermaLink="false">36379@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;pre&#62;struct node {
   int data;
   struct node* left;
   struct node* right;
};
typedef struct node* Node;  

//root: Current tree node
//prev: this pointer should have the address of in-order predecessor of root
//head: this denoted head of final link list
void treeToDoublyList(Node root, Node &#38;amp; prev, Node &#38;amp; head)
{
   if (!root) return;
   treeToDoublyList(root-&#38;gt;left, prev, head);  

   // current node's left points to previous node
   root-&#38;gt;left = prev;
   if (prev)
       prev-&#38;gt;right = root; // previous node's right points to current node
   else
       head = root;        // if previous is NULL that current node is head  

   Node right = root-&#38;gt;right; //Saving right node  

   //Now we need to make list created till now as circular
   head-&#38;gt;left = root;
   root-&#38;gt;right = head;  

   //For right-subtree/parent, current node is in-order predecessor
   prev = root;
   treeToDoublyList(right, prev, head);
}  

//Wrapper function
Node treeToDoublyList(Node root)
{
   Node prev = NULL;
   Node head = NULL;
   treeToDoublyList(root, prev, head);
   return head;
}&#60;/pre&#62;</description>
		</item>
		<item>
			<title>kartik_patil on "MindTree Interview Question for Software Engineer/Developer (Fresher) about Algorithms"</title>
			<link>http://geeksforgeeks.org/forum/topic/mindtree-interview-question-for-software-engineerdeveloper-fresher-about-algorithms-1#post-36378</link>
			<pubDate>Sat, 04 Feb 2012 16:23:22 +0000</pubDate>
			<dc:creator>kartik_patil</dc:creator>
			<guid isPermaLink="false">36378@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Given a log file that contains latency for each request of an API, how to calculate the median of the API latency?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>kartik_patil on "MindTree Interview Question for Software Engineer/Developer (Fresher) about Algorithms"</title>
			<link>http://geeksforgeeks.org/forum/topic/mindtree-interview-question-for-software-engineerdeveloper-fresher-about-algorithms#post-36377</link>
			<pubDate>Sat, 04 Feb 2012 16:21:43 +0000</pubDate>
			<dc:creator>kartik_patil</dc:creator>
			<guid isPermaLink="false">36377@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;Given a log file that contains latency for each request of an API, how to calculate the median of the API latency?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Engineer/Developer about Arrays"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-arrays-32#post-36376</link>
			<pubDate>Fri, 03 Feb 2012 20:51:49 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36376@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;&#60;em&#62;&#60;strong&#62;Running Complexity O(n)&#60;/strong&#62;&#60;/em&#62;&#60;/p&#62;
&#60;pre&#62;
#include&#38;lt;stdio.h&#38;gt;
#include&#38;lt;stdlib.h&#38;gt;

int* blabberedQuickSort (int *arr1, int *arr2, int len1, int len2) {
  int lindex1 = len1-1, lindex2 = len2-1 ;
  int actindex = (len1+len2-1);
  while ( lindex1&#38;gt;=0 &#38;amp;&#38;amp; lindex2&#38;gt;=0 ) {
    if (arr1[lindex1] &#38;gt; arr2[lindex2]) {
      arr2[actindex--] = arr1[lindex1--];
    } else {
      arr2[actindex--] = arr2[lindex2--];
    }
  }
  while (lindex1&#38;gt;=0) {
    arr2[actindex--] = arr1[lindex1--];
  }
 /* We do not need to do the same for arr2 because they all are sorter already */
  return arr2 ;
}

void printList (int *arr, int len) {
  int i ;
  printf ( &#34;\n\n&#34; ) ;
  for ( i = 0 ; i &#38;lt; len ; i ++ )
    printf ( &#34;%d &#34;, arr[i] );
  printf ( &#34;\n&#34; ) ;
}

int main() {
  int len1, len2 ;
  int *arr1, *arr2 ;
  int i;
  printf ( &#34;\nEnter the number of elements of array1 :\t&#34; ) ;
  scanf ( &#34;%d&#34;, &#38;amp;len1 );
  arr1 = (int *) malloc (sizeof(int) * len1);
  for ( i = 0 ; i &#38;lt; len1 ; i ++ ) {
    printf ( &#34;\nArray_1[%d] = &#34;, i ) ;
    scanf ( &#34;%d&#34;, &#38;amp;arr1[i] ) ;
  }

  printf ( &#34;\nEnter the number of elements of array2 :\t&#34; ) ;
  scanf ( &#34;%d&#34;, &#38;amp;len2 );
  arr2 = (int *) malloc (sizeof(int) * (len2+len1));
  for ( i = 0 ; i &#38;lt; len2 ; i ++ ) {
    printf ( &#34;\nArray_2[%d] = &#34;, i ) ;
    scanf ( &#34;%d&#34;, &#38;amp;arr2[i] ) ;
  }
  printList (arr1,len1) ;
  printList (arr2,len2) ;
  arr2 = blabberedQuickSort (arr1,arr2,len1,len2);
  printList (arr2,len1+len2) ;
  return 1 ;
}
&#60;/pre&#62;</description>
		</item>
		<item>
			<title>PsychoCoder on "Amazon Interview Question for Software Testing (0 - 2 Years)"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-testing-0-2-years#post-36375</link>
			<pubDate>Fri, 03 Feb 2012 19:04:18 +0000</pubDate>
			<dc:creator>PsychoCoder</dc:creator>
			<guid isPermaLink="false">36375@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;@padmaja_39 : You should handle the negative number caused by (arr[i]-num)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>kartik on "Amazon Interview Question for Software Engineer/Developer about Algorithms"</title>
			<link>http://geeksforgeeks.org/forum/topic/amazon-interview-question-for-software-engineerdeveloper-about-algorithms-94#post-36374</link>
			<pubDate>Fri, 03 Feb 2012 19:01:13 +0000</pubDate>
			<dc:creator>kartik</dc:creator>
			<guid isPermaLink="false">36374@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;\Round5 &#124; Q2 : Suppose, Amazon have a Logging system Like This:&#60;/p&#62;
&#60;p&#62;They Track all logs daily basis, stored in separate log file.Log contains a collection of tuples of Customer ID and Page ID. The length of Customer ID and Page ID is L1 and L2. Suppose We have a log of D-days , and size of each log fine can be Order of n , where n be the number of customer.&#60;br /&#62;
In a most generalized situation, you can assume that a customer can visit the same page multiple times in a day or any number of days.&#60;/p&#62;
&#60;p&#62;We are interested to find out the number of Distinct customer visited at-least p distinct pages within exactly T days.&#60;/p&#62;
&#60;p&#62;Propose a Data Structure to be use to solve this problem efficiently . Design an Algorithm to solve this problem and Find out the complexity of the algorithm.&#60;/p&#62;
&#60;p&#62;{Hints:- Double Hashing/ {Hashing +Tries/BST }}&#60;/p&#62;
&#60;p&#62;By Sourabh (&#60;a href=&#34;http://www.geeksforgeeks.org/archives/17629/comment-page-1#comment-7362&#34; rel=&#34;nofollow&#34;&#62;http://www.geeksforgeeks.org/archives/17629/comment-page-1#comment-7362&#60;/a&#62;)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>kartik on "Printing all repeated combination of given lengthof a string"</title>
			<link>http://geeksforgeeks.org/forum/topic/printing-all-repeated-combination-of-given-lengthof-a-string#post-36373</link>
			<pubDate>Fri, 03 Feb 2012 15:54:07 +0000</pubDate>
			<dc:creator>kartik</dc:creator>
			<guid isPermaLink="false">36373@http://geeksforgeeks.org/forum/</guid>
			<description>&#60;p&#62;@PsychoCoder:  Awesome code!.&#60;br /&#62;
Few small points&#60;br /&#62;
1) The allocated memory for data should be (len +1) characters.  One extra space is needed for string terminator (\O)&#60;br /&#62;
2) data[len] should be set as string terminator character before calling allLexicographicCombo ()&#60;br /&#62;
3) String should be sorted before calling allLexicographicCombo(), as the output strings are expected to be in sorted order.&#60;/p&#62;
&#60;p&#62;We can probably write a wrapper function that allocates memory for data, does above 3 things, and calls allLexicographicCombo ().
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>

