Time complexity of inorder traversal in O(1) space

#1

Problem 9.11 (Python version of the book),
9.11 Implement An Inorder Traversal in O(1) Space

Solution says time complexity is O(n). How can that be true if you will visit same node multiple times when trying to find the next node?

Also, is this time complexity same if you use the find_successor code (previous problem)?

0 Likes