MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / Node

Struct Node

compression/huffmancoding.go:19–24  ·  view source on GitHub ↗

A Node of an Huffman tree, which can either be a leaf or an internal node. Each node has a weight. A leaf node has an associated symbol, but no children (i.e., left == right == nil). A parent node has a left and right child and no symbol (i.e., symbol == -1).

Source from the content-addressed store, hash-verified

17// A leaf node has an associated symbol, but no children (i.e., left == right == nil).
18// A parent node has a left and right child and no symbol (i.e., symbol == -1).
19type Node struct {
20 left *Node
21 right *Node
22 symbol rune
23 weight int
24}
25
26// A SymbolFreq is a pair of a symbol and its associated frequency.
27type SymbolFreq struct {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected