Re: [algogeeks] [URGENNT] : naukri.com paper pattern

2012-03-30 Thread Manni mbd
speed and time mangement were only hurdle.

On Thu, Mar 29, 2012 at 1:24 AM, Aman Goyal aman.goya...@gmail.com wrote:

 10 multiple choice questions on C : very easy , Kanetkar will suffice.

 Aptitude : subjective , with mostly mathematical puzzles . Lengthy due to
 time consuming problems. Focus on accuracy .Series completion, Time speed
 distance,permutation and combination is what i can recall in the aptitude
 paper.

 On Tue, Mar 27, 2012 at 8:07 PM, aditya gupta g.aditya.i...@gmail.comwrote:

 Hi all,

 nauri.com is visiting at my friend's college , can someone plz tell the
 pattern of its paper??

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] [Combinatorics] count possible number of binary search trees, given number of nodes

2012-02-10 Thread Manni mbd
are you sure u want to ask BINARY SEARCH treees and not Binary trees..

On 1/29/12, Moheed Moheed Ahmad mohe...@gmail.com wrote:
 I know how to solve it programatically, can anybody pls help me to solve it
 using combinatorics.
 -Moheed

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C concept on memory layout

2012-02-07 Thread Manni mbd
i didn't got .. !! please explain some more..

On 2/7/12, sumit mahamuni sumit143smail...@gmail.com wrote:
 Hello,

 Here you are right about variable p in add function that it retains it's
 value even though function loses its scope. And for main function error you
 are seeing has nothing to do with how that variable is stored?
 It is about the scope of that variable C compiler sees the scope of static
 variable p  limited to add function only, so other function can't use it.
 And remember error is at compile time not run time so it is related to
 compiler not memory. I hope it explains everything.

 On Tue, Feb 7, 2012 at 9:43 AM, atul anand atul.87fri...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/14268


 On Tue, Feb 7, 2012 at 1:06 AM, gmagog...@gmail.com
 gmagog...@gmail.comwrote:

 I think you are right about p being in BSS segment and it does last even
 the function finishes, however, you may need a pointer to get the data
 out
 of p. Then you can read the data.

 Correct me if i am wrong


 On Mon, Feb 6, 2012 at 1:04 PM, Ravi Ranjan
 ravi.cool2...@gmail.comwrote:

 i have a confusion in it

 #include stdio.h
 #include stdlib.h


 void add(int,int);

 int main(int argc, char *argv[])
 {

 add(6,3);
 printf(%d,p);

   system(PAUSE);
   return 0;
 }


 void add(int a, int b)
 {
   static int p;
 p = a+ b;
 }


 here the memory layout says variable p is in BSS segment ... so its an
 independent region from stack frame. when the function looses its
 scope
 from function defination(add) then still it should be alive... and can
 be
 recognized/used by other function(main) but it gves an error of
 unknown
 variable p.  need the correct logic... if i m wrong...

 thanx
 ravi

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards,
 Sumit Mahamuni.

 -- Slow code that scales better can be faster than fast code that doesn't
 scale!
 -- Tough times never lasts, but tough people do.
 -- I love deadlines. I like the whooshing sound they make as they fly by. -
 D. Adams

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2012-02-07 Thread Manni mbd
@^ : We are just going to do a BFS kind of thing is crawler, its
better to use a bqueue/b for implementing it.
rest to store it , we can use accordingly like if we have just to
store the URL we can use a pretty simple DS like arrays, or say
Linklists(if its very large) .
but if we need to store entire thing HTML , then we have to go to DOM
structures so store it, in something like XML tags.

On 2/7/12, Durgesh Kumar durgesh1...@gmail.com wrote:
 U can use dictionary or linked list 

 Better if U choose language like python or java.

 Python have module named Urllib2 and httplib2 which implements all
 the functions for getiing ,posting and browsing data.


 INFORMAL ALGORITHM..

 1. Start with any arbitray link. LINK=[new link]
 2.aGet html content of the link .
bParse the required Content and store it .
cAdd the new link on the page to the LINK it it is not present there.
 3.Repeat step 2 untill U want to crawl.

 On 2/5/12, Ravi Ranjan ravi.cool2...@gmail.com wrote:
 what will the algorithm and the appropriate data structure to implement a
 web crawler??

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 *Durgesh Kumar*
 Final Year, B.tech
 Information Technology
 HALDIA INSTITUTE OF TCHNOLOGY
 HALDIA

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] doubt about macro.......

2012-02-04 Thread Manni mbd
int main ()
{
int g= 1, h= 2;
 int t; t=g;g=h;h=t;
}

hope this helps

On 2/4/12, rahul sharma rahul23111...@gmail.com wrote:
 swap(a,b,c) c t;t=a;a=b;b=t;


 int main()
 {
 int g=1,h=2;
 swap(g,h,int);
 }

 how the actual values are replace???
 a and b are replaced with g and hactual are replace..can somebody tell
 me expanded source code???

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] nvidia qstn

2012-02-03 Thread Manni mbd
can use a ternary tree kind of datastructure where each node will
contain  a pointer to the next character, It's better than trie becoz
at each node rather than storing all 26 english characters or say 255
characters we only store the possible characters to the next level.

Now to get the possible combinations we can reach that level and then
print all the possible words to the down of that tree..!! going left
right and center..

On 2/3/12, Ravi Ranjan ravi.cool2...@gmail.com wrote:
 Implement a MS key suggest like tool where on typing the first letters will
 give a list of words starting with the typed text. The corpus will be
 provided as a text file. Max number of characters in a word is 10.
  - Say you type 'i', it should provide 'include | if ' as the words in the
 dropdown

 do it with minimum complexity???

 less than O(n)

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon written test question

2012-02-02 Thread Manni mbd
Forget my previous post. it useless i think
Firstly there will be only 1 node upwards which will be at a distance
K units from the specified node.
so we can take help of recursion

int kthDistance(node *root, int k ,node *start){
static node * kthUp = NULL;
int distance = -1;
if(node ==NULL) return -1;
else if(node==Start) return 0;
else{
if(node-left){
 leftDepth = kthDistance(node-left);
 if(leftDepth=0)  distance = leftDepth+1;
}
if(node-right  distance0){
rightDepth = kthDistance(node-right);
if(rightDepth =0) distance = rightDepth+1;
}
if(distance ==k) kthUp = node;
return distance;
}
.

hope this helps

On 2/1/12, atul anand atul.87fri...@gmail.com wrote:
 @Manni : didnt get your algo for upward nodes.

 On Wed, Feb 1, 2012 at 2:30 PM, Manni mbd mbd2...@gmail.com wrote:

 ^same as above..
 for upward.. start again from the nodes now distance is distance is
 (distance of start node -k) .. if you reach this from the root.. print
 it..
 also better is we use array rather than using linked list .. as
 sorting can be a tedious task in case of link lists !

 On 2/1/12, atul anand atul.87fri...@gmail.com wrote:
  if it is binary tree then to print the downward node...
  we can search for start node and then do level-order traversal or BFS
 from
  start node till distance K recursively.
 
  no as we want nodes to be printed in sorted order..what we do is crated
  a
  linked-list and insert nodes (found in above method) in sorted way.
  then print the linked list.
 
  for upward nodes. thinking...
 
  On Wed, Feb 1, 2012 at 9:52 AM, atul anand atul.87fri...@gmail.com
 wrote:
 
  are you sure given tree is binary tree and not BST.
  if it is BST then we can search start node and then do inorder
  traversal
  from there.
  before thinking printing abt upward node...please confirm if it a
  binary
  tree or BST.
 
 
  On Tue, Jan 31, 2012 at 9:27 PM, Dhirendra Singh dps...@gmail.com
 wrote:
 
 
  You are given a function printKDistanceNodes which takes in a root
  node
  of a binary tree, a start node and an integer K. Complete the function
 to
  print the value of all the nodes (one-per-line) which are a K distance
  from
  the given start node in sorted order. Distance can be upwards or
  downwards.
 
 
  anyone any idea ?? how to print nodes above the specified node,
 
  Note : we do not have a reference to parent
 
 
 
 
 
   --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon written test question

2012-02-01 Thread Manni mbd
^same as above..
for upward.. start again from the nodes now distance is distance is
(distance of start node -k) .. if you reach this from the root.. print
it..
also better is we use array rather than using linked list .. as
sorting can be a tedious task in case of link lists !

On 2/1/12, atul anand atul.87fri...@gmail.com wrote:
 if it is binary tree then to print the downward node...
 we can search for start node and then do level-order traversal or BFS from
 start node till distance K recursively.

 no as we want nodes to be printed in sorted order..what we do is crated a
 linked-list and insert nodes (found in above method) in sorted way.
 then print the linked list.

 for upward nodes. thinking...

 On Wed, Feb 1, 2012 at 9:52 AM, atul anand atul.87fri...@gmail.com wrote:

 are you sure given tree is binary tree and not BST.
 if it is BST then we can search start node and then do inorder traversal
 from there.
 before thinking printing abt upward node...please confirm if it a binary
 tree or BST.


 On Tue, Jan 31, 2012 at 9:27 PM, Dhirendra Singh dps...@gmail.com wrote:


 You are given a function printKDistanceNodes which takes in a root node
 of a binary tree, a start node and an integer K. Complete the function to
 print the value of all the nodes (one-per-line) which are a K distance
 from
 the given start node in sorted order. Distance can be upwards or
 downwards.


 anyone any idea ?? how to print nodes above the specified node,

 Note : we do not have a reference to parent





  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Find all longest increasing subsequence of length k

2012-01-29 Thread Manni mbd
@Manee: can u explain a bit more !! still unclear

On 1/30/12, Manee mani.ma...@gmail.com wrote:
 store all the indices wherever the value decreases. all subsequences
 between 0, these indices and the end index n are increasing
 subsequences.

 Check which of these are of length K.



 On Jan 26, 11:17 pm, atul anand atul.87fri...@gmail.com wrote:
 Hi,

 suggest an algo which will find all longest increasing sub
 sequence of length K.

 for eg:-
 input : 7 8 9 4 10 11
 K=3

 output :
 7 8 9
 7 9 10
 7 10 11
 8 9 10
 8 10 11

 desired complexity : O(k*n*logn)

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.