Answer: O(n)
Printing
the elements in an order means the elements should be printed in sorted order.
Inorder traversal of
BST gives the sorted order and takes O(n) time.
When a tree is
traversed, every node of tree has to be traversed. So, if a tree has n nodes,
the time complexity is O(n).
0 comments:
Post a Comment