Skip to content

satellite: implement exercise - #1831

Merged
jmrunkle merged 4 commits into
masterfrom
unknown repository
Apr 25, 2020
Merged

jmrunkle merged 4 commits into
masterfrom
unknown repository

Conversation

@jmrunkle

Copy link
Copy Markdown
Contributor

Fixes #1751.


Reviewer Resources:

Track Policies

@jmrunkle

Copy link
Copy Markdown
Contributor Author

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 toString method and asserting that the toString of the returned tree matches the toString of the expected tree.

@jmrunkle
jmrunkle merged commit 6b2e645 into exercism:master Apr 25, 2020
@jmrunkle
jmrunkle deleted the satellite branch April 25, 2020 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

satellite: implement exercise

1 participant