diff --git a/packages/fdr-sdk/src/utils/traversers/prunetree.ts b/packages/fdr-sdk/src/utils/traversers/prunetree.ts index 815e021ff2..122d20ec5d 100644 --- a/packages/fdr-sdk/src/utils/traversers/prunetree.ts +++ b/packages/fdr-sdk/src/utils/traversers/prunetree.ts @@ -37,6 +37,8 @@ interface PruneTreeOptions { getPointer?: (node: NODE) => POINTER; } +// TODO: this algorithm is not optimal, as it traverses the tree twice, and should be refactored to traverse only once +// it would be more efficient to BFS the tree once, collect all the nodes in an array, and reverse the array to delete the nodes from the bottom up export function prunetree( root: ROOT, opts: PruneTreeOptions,