I have the following pseudo-code for printing all nodes of a BST :traverse(x):    if x == nil:        return    else:        print x        traverse(x.left)        traverse(x.right)I want to find its complexity. I have an idea, but I'm not sure if I am implementing it correctly.$T(n) = 2T(n-1) + cn$Where $T(n-1)$ for each recursive call and $cn$ for the return statement.Is my solution correct?
Complexity of BST
time complexity;asymptotics;search algorithms;search trees
What i said in previous reply was about finding a node. I excuse for misunderstanding your question. For worst case its the same but for printing in average case it's $T(n)=2T(n/2)+1$ which is $O(n)$.