reorganisation of fonctions and file

This commit is contained in:
2025-04-11 12:12:13 +02:00
parent 16f1cd067b
commit 7d0f215f26
3 changed files with 88 additions and 76 deletions

View File

@@ -165,3 +165,15 @@ pub fn read_tree(binary: &str, chars: &Vec<char>) -> Node {
}
root
}
pub fn nodes_at_vec(map: HashMap<char, i32>) -> Vec<Node> {
let mut nodes = Vec::new();
for (key, value) in &map {
let mut node = Node::new();
node.set_char(*key);
node.set_counter(*value);
nodes.push(node);
}
nodes.sort();
nodes
}