MCPcopy Create free account
hub / github.com/algorithm-archivists/algorithm-archive / dfs

Method dfs

contents/huffman_encoding/code/rust/huffman.rs:113–127  ·  view source on GitHub ↗
(&self, code: String, codebook: &mut HashMap<char, String>)

Source from the content-addressed store, hash-verified

111 }
112
113 fn dfs(&self, code: String, codebook: &mut HashMap<char, String>) {
114 match *self {
115 HuffmanTree::Branch {
116 ref left,
117 ref right,
118 ..
119 } => {
120 left.dfs(code.clone() + "0", codebook);
121 right.dfs(code.clone() + "1", codebook);
122 }
123 HuffmanTree::Leaf { value, .. } => {
124 codebook.insert(value, code);
125 }
126 }
127 }
128}
129
130impl Codebook {

Callers 1

make_codebookMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected