413 views
0 votes
0 votes
if we know that the inorder of a balanced binary search tree is in ascending order, than can we say that the tym complexity to find this is O(1)??????

1 Answer

0 votes
0 votes
in BST,we visit each node exactly 3 times with constant amount of time..therefore for inorder traversal.we visit

n*3*c=O(n).time complexity.

where n=no of nodes,c=constant amount of time spend on each node.

even,this complexity is applicable for postorder and preorder too.

Related questions

0 votes
0 votes
1 answer
4
Abhrajyoti00 asked Oct 29, 2022
718 views
Can there be “Stack Overflow” in Linked list Implementation of stack? If Yes, how?