reorganisation of fonctions and file
This commit is contained in:
12
src/node.rs
12
src/node.rs
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user