exercism/go/tree-building
Brian Buller 2f99878b09 Syncing Up 2016-09-09 11:24:29 -05:00
..
README.md Syncing Up 2016-09-09 11:24:29 -05:00
tree_building.go Syncing Up 2016-09-09 11:24:29 -05:00
tree_test.go Syncing Up 2016-09-09 11:24:29 -05:00

README.md

Tree Building

Refactor a tree building algorithm.

Some web-forums have a tree layout, so posts are presented as a tree. However the posts are typically stored in a database as an unsorted set of records. Thus when presenting the posts to the user the tree structure has to be reconstructed.

Your job will be to refactor a working but slow and ugly piece of code that implements the tree building logic for highly abstracted records. The records only contain an ID number and a parent ID number. The ID number is always between 0 (inclusive) and the length of the record list (exclusive). No record has a parent ID lower than its own ID and no record, except the root record, has a parent ID that's equal to its own ID.

To run the tests simply run the command go test in the exercise directory.

If the test suite contains benchmarks, you can run these with the -bench flag:

go test -bench .

For more detailed info about the Go track see the help page.

Submitting Incomplete Problems

It's possible to submit an incomplete solution so you can see how others have completed the exercise.