ctci
ctci copied to clipboard
4.8 Java
The question said both trees are very large. Does it mean we should not use a recursive way of doing this?
Complexity will remain same in case of recursion.
But recursion may get stack overflow, doesn't it?
Yeah it will. But I think we have to assume that our system can handle O(n) space.
For what it's worth, I didn't use recursion for my solution precisely because it mentioned the trees are large.
Then why does the question mention the size of the tree? Is it just useless or some kinda clue?