Skip to content

Commit

Permalink
remove benches code
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgapp committed Jun 26, 2023
1 parent fd8f349 commit 625be6e
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions benches/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,3 @@ pub fn build_deep_tree<T, N>(
})
.collect()
}

/// A helper function to construct a tree with a fixed number of children per level
/* The tree would look something like (for per_level_child_count = 3):
N, N, N
|
N, N, N
|
N, N, N
...
*/
#[allow(dead_code)]
pub fn build_linear_tree_with_n_children_per_level<T, N: Copy>(
tree: &mut T,
max_nodes: u32,
per_level_child_count: u32,
create_node: &mut impl FnMut(&mut T) -> N,
append_child: &mut impl FnMut(&mut T, N, N),
) -> N {
let mut node_count = max_nodes as i32;
let root = create_node(tree);
let mut parent = root;

while node_count > 0 {
let mut next_parent = parent;
for _ in 0..per_level_child_count {
let child = create_node(tree);
append_child(tree, parent, child);
node_count -= 1;
next_parent = child;
}
parent = next_parent;
}

root
}

0 comments on commit 625be6e

Please sign in to comment.