Recursion and the base case

F-RECURSE-V4-2medium

Build root-to-directory paths

A directory-manifest tool reports path depth, reconstructs root-to-directory paths and totals bytes from supplied parent records.

What needs to change

Repair chain so the manifest gives each directory’s root-to-directory path.

Reproduce

  1. Run main.go with go run with Sample manifest and compare the paths for docs and reports.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The main.go with go run reader, parent lookup and caller are supplied. Input is directory ID and parent ID per row, with - for the single root. IDs are unique; the connected parent graph has no cycles. Every nonroot parent exists and following parents reaches the single root. Rows may be listed in any order. IDs are path components, not -, with no / or whitespace. At most 100 directories are supplied.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in