void inorder(Node *root){
if(root!=NULL){
inorder(root->left);
cout<<root->key<<" ";
inorder(root->right);
}
I want to know how is inorder traversal of binary tree is O(n) mathematically? Shouldn't it be T(N) = 2*T(n-1) + const. ?
void inorder(Node *root){
if(root!=NULL){
inorder(root->left);
cout<<root->key<<" ";
inorder(root->right);
}
I want to know how is inorder traversal of binary tree is O(n) mathematically? Shouldn't it be T(N) = 2*T(n-1) + const. ?