Re: [algogeeks] LCA of a Binary tree not a binary search tree

2011-11-13 Thread aritra kundu
struct node{ int data; struct node* left; struct node* right; }; struct node* lca(struct node* root,struct node* a,struct node* b){ if(!root) return NULL; if( root==a || root ==b) return root; struct node* left = lca(root->left,a,b); struct node* right = lca(root->rig

[algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread aritra kundu
*Question 1 / 1* Given an integer *N*, there are *2^N* binary codewords of length N. All of them are taken and sorted to create a sequence: Sort by the number of 1-bits in the codeword bit-string. If there is a tie, break tie so that the smaller number comes first in the output sequence *Testcases