Given a binary tree, return the preorder traversal of its nodes’ values.
Example:
Input: [1,null,2,3]
1
\
2
/
3Output: [1,2,3]
TC - O(n)
SC - O(n)
Pseudo Code:
Given a binary tree, return the inorder traversal of its nodes’ values.
Example:
Input: [1,null,2,3]
1
\
2
/
3Output: [1,3,2]
TC - O(n)
SC - O(n)
Pseudo Code:
Given a binary tree, return the postorder traversal of its nodes’ values.
Example:
Input: [1,null,2,3]
1
\
2
/
3Output: [3,2,1]
TC - O(n)
SC - O(n)
Pseudo Code: