Skip to main content

insert_path_iterative_with_stack

Function insert_path_iterative_with_stack 

Source
pub fn insert_path_iterative_with_stack(
    tree: &mut BTreeMap<String, Box<Tree>>,
    parts: &[&str],
)
Expand description

Inserts a path (as dot-separated parts) into the tree structure (ITERATIVE VERSION - Explicit Stack)

This version uses an explicit stack to simulate the recursive call stack. More complex but demonstrates the principle of converting recursion to iteration.

ยงArguments

  • tree - The tree node to insert into
  • parts - Slice of path parts to insert