take countr to be a static variable ... that shud do the job ...!! btw ...if thats nt the case ... thn i m nt pretty sure wat u are asking to be done ...
On Sun, Jul 31, 2011 at 2:12 AM, Rahul Mittal <[email protected]>wrote: > help me with this > we need to find out how many times a function is recursively called > while inserting a node in bst. > > insert (number X, node N) > increase the counter C by 1 > if X is less than the number in node N > if N has no left child > create a new node with the number X and set > it to be the left child of node N > else > insert (X, left child of node N) > else (X is greater than the number in node N) > if N has no right child > create a new node with the number X and set > it to be the right child of node N > else > insert (X, right child of node N) > we need value of count > PS:this algorithm will exceed time limit > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
