Under Print Output Format, the examples for Postfix format and Prefix format don't have a whitespace character at the end.
Postfix format: 34 6 + -8 4 / -
Prefix format: - + 34 6 / -8 4
However, the Sample Execution Run does in fact include a trailing whitespace character for the Expression tree prefix and postfix expression.
Expression tree in postfix expression: 34 6 + -8 4 / -
Expression tree in prefix expression: - + 34 6 / -8 4
(Try highlighting the above lines to see what I'm referring to).
Considering that the standard version for pre-order and post-order traversal leads one to emit a trailing whitespace, it may be a good idea to mention that a trailing whitespace character is mandatory for printPrefix and printPostfix. I'm not sure how pedantic the submission server is in validating spaces, but the current situation could lead to ambiguity in the future.
Under
Print Output Format, the examples for Postfix format and Prefix format don't have a whitespace character at the end.However, the
Sample Execution Rundoes in fact include a trailing whitespace character for theExpression tree prefix and postfix expression.(Try highlighting the above lines to see what I'm referring to).
Considering that the standard version for pre-order and post-order traversal leads one to emit a trailing whitespace, it may be a good idea to mention that a trailing whitespace character is mandatory for printPrefix and printPostfix. I'm not sure how pedantic the submission server is in validating spaces, but the current situation could lead to ambiguity in the future.