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 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.

Reply via email to