plz tell the time complexity of my code which checks whether each node contains sum of left and right subtree or not…
i think it is O(no of nodes)…plz confirm…
Time compexity of the code
yes since u are traversing each node once hence the complexity is O(no of nodes)
time complexity of the function is bst…
i think it is O(n);
plz confirm…
yes is binary tree question wheere we visit nodes just one
worst case complexity comes out to be O(N) so is the case here
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.