Repository navigation
Conversation
|
I decided to have this return an object rather than using some string-like representation of a tree. This decision left me with some interesting options for how to verify that the tree is correct. Checking a tree for equality effectively means checking that the traversals are the same, so I went with checking that the traversals matched the input and then verifying that the remaining traversal (postorder) was also correct as a checksum. I figured this would make it difficult to just try to fake the solution by storing the preorder and inorder traversals and simply returning those (since it would be quite difficult to determine the postorder from the preorder and inorder without constructing the actual tree. If someone else feels strongly about an alternative implementation, I could see about overriding a |
Fixes #1751.
Reviewer Resources:
Track Policies