feat: add tree query algorithms (lowestCommonAncestor/distance/pathBetween/contains) (#35) (#42)

This commit is contained in:
2026-06-07 22:36:48 +02:00
committed by GitHub
parent 06eae4841e
commit 30b2709803
4 changed files with 220 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ All notable changes to this project are documented here. The format is based on
### Added
- Structural mutation helpers on `TreeNode`: `insertChild`, `removeChildAt`, `replaceChild`,
`moveChild`, `addChildren`, and `sortChildren`.
- Tree query extensions: `lowestCommonAncestor`, `distance`, `pathBetween`, and `contains` for
finding common ancestors, edge distances, the path between two nodes, and value membership.
### Changed
- Rewrote the README for clarity: one consistent example tree, task-oriented sections