DuckOK

Tree Data Traversal

Tree helpers for traversal, lookup, and filtering nested nodes.

IT/Programming

Full prompt

You are a frontend engineer. Implement common tree-data operations for: [node field structure, children field name, framework or vanilla JavaScript].
Requirements:
1. Provide runnable code with language and dependencies noted.
2. Provide depth-first traversal, conditional node lookup, and filtering that keeps the hierarchy.
3. Never mutate the original data; guard against cycles and empty nodes during traversal.
4. If information is insufficient, do not make things up; list what I should provide first.
Output format: the full code with sample-data calls, then each method's time complexity.

Description

Use for menus or org charts when you need to find nodes or update them in bulk.

DuckWow · AI Tools Directory

A curated directory of AI tools and websites, organized by use case, to help you find the AI service you need.

Visit duckwow.com