Let's now take a look at the space and time complexity for the approach that we came up with in the
previous video, where we implemented in-order traversal in an iterative manner.
Now the time complexity is going to be of the order of n, where n is the number of nodes in the given
binary tree.
And that's the case because we will be visiting every node one time.
Now, when it comes to the space complexity, it's going to be of the order of n, because in the worst
case, if we have a tree that looks like this, which is a skewed binary tree, we would have to add
all of these values to the stack.
So that's why in the worst case, the space complexity is going to be of the order of n.