Sha256: 7eca00d25e9752e524f821ab356eff5a2cff5f2b5f519318d825581ff7ce9552

Contents?: true

Size: 670 Bytes

Versions: 38

Compression:

Stored size: 670 Bytes

Contents

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.

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
trackler-2.0.5.1 common/exercises/tree-building/description.md
trackler-2.0.5.0 common/exercises/tree-building/description.md
trackler-2.0.4.0 common/exercises/tree-building/description.md
trackler-2.0.3.9 common/exercises/tree-building/description.md
trackler-2.0.3.8 common/exercises/tree-building/description.md
trackler-2.0.3.7 common/exercises/tree-building/description.md
trackler-2.0.3.6 common/exercises/tree-building/description.md
trackler-2.0.3.5 common/exercises/tree-building/description.md
trackler-2.0.3.4 common/exercises/tree-building/description.md
trackler-2.0.3.3 common/exercises/tree-building/description.md
trackler-2.0.3.2 common/exercises/tree-building/description.md
trackler-2.0.3.1 common/exercises/tree-building/description.md
trackler-2.0.3.0 common/exercises/tree-building/description.md
trackler-2.0.2.0 common/exercises/tree-building/description.md
trackler-2.0.1.2 common/exercises/tree-building/description.md
trackler-2.0.1.1 common/exercises/tree-building/description.md
trackler-2.0.1.0 common/exercises/tree-building/description.md
trackler-2.0.0.10 common/exercises/tree-building/description.md
trackler-2.0.0.9 common/exercises/tree-building/description.md
trackler-2.0.0.8 common/exercises/tree-building/description.md