MCPcopy Index your code
hub / github.com/TheAlgorithms/Rust / new

Method new

src/general/huffman_encoding.rs:93–153  ·  view source on GitHub ↗

Creates a new Huffman dictionary from alphabet symbols and their frequencies. Returns `None` if the alphabet is empty. # Arguments `alphabet` - A slice of tuples containing symbols and their frequencies # Example ``` # use the_algorithms_rust::general::HuffmanDictionary; let freq = vec![('a', 5), ('b', 2), ('c', 1)]; let dict = HuffmanDictionary::new(&freq).unwrap();

(alphabet: &[(T, u64)])

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 6

pushMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
insertMethod · 0.45
iterMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected