Question
Given a binary tree, return the inorder traversal of its nodes’ values.
Example:
|
|
Follow up: Recursive solution is trivial, could you do it iteratively?
Answer
Recursive
|
|
Running time: O(n), 1ms
Iterative
|
|
Running time: O(n), 2ms
Anne.github.io
Given a binary tree, return the inorder traversal of its nodes’ values.
Example:
|
|
Follow up: Recursive solution is trivial, could you do it iteratively?
|
|
Running time: O(n), 1ms
|
|
Running time: O(n), 2ms