DEV Community

Discussion on: When Recursion Comes to Rescue

Collapse
pentacular profile image
pentacular

This is a topological sort.

Recursion is where we take a problem of a given form and either solve it or turn it into a smaller problem of the same form.

This is a valid strategy for this problem, as you've noticed, but it may lead to overconstrained solutions - you're imposing an ordering between subtasks that does not need to be there.