Checkpoint: recursion and graphs
123 / 170Checkpoint: recursion and graphsLesson 2 of 3About 147 min
Recursion, generation, two traversals, connectivity, and a design. No labels.
Sum integers nested inside lists, weighting each by how deeply it sits. Decide what a node needs to know from above before you pick a signature.
Produce every sentence formed by taking one word from each list, in order. The branching factor comes from the data rather than being fixed.
Find the fewest steps from any of several starting cells to the target. Running one search per start is the obvious approach; there is a better one you have already written.
Report how long the farthest district takes to reach any hospital. Two things to get right: the search shape, and what to report when somewhere cannot reach one at all.
Count pairs of nodes that sit in different components. Enumerating pairs is far too slow; work out what the component sizes alone tell you.
Support insert, delete, and a query returning everything under a prefix. Deletion is the part the reading did not cover; decide what happens to a node once nothing beneath it remains.