Time complexities - binary trees

how sir is calculating time complexities in all the binary tree operations? like for height of a tree it is O(n) and how will i know for others operations? and what is ‘n’ in that O(n) ??

@sktg99
n here is the total no of nodes in the given tree. As you said , the complexity to compute height of a tree is O(n) as we have to visit over all the nodes to find the height of the tree. We compute the time complexities for tree algorithms by simply getting an approxiamate count of how many times each node was visited. You will understand how its done by the time you complete all its tutorials however if you still need any help , let me know here.