btll

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryTree

type BinaryTree struct {
	Root  *TreeNode
	Depth int
}

BinaryTree - represent binary tree

func (*BinaryTree) CreateTree

func (bt *BinaryTree) CreateTree(list *NodeList)

CreateTree - creates tree from list

func (*BinaryTree) EncodeSymbols

func (bt *BinaryTree) EncodeSymbols(symbolsToEncode []rune) []Encoded

EncodeSymbols encodes symbols to binary by created tree

type Encoded

type Encoded struct {
	Symb rune
	Code string
}

Encoded struct represents symbol and it's encoded form

type Node

type Node struct {
	Data interface{}
	Freq float64
	Next *Node
	Prev *Node
}

Node - represent element of NodeList

Data - data to be coded
Freq - frequency of occurrence

type NodeList

type NodeList struct {
	Head   *Node
	Tail   *Node
	Length int
}

NodeList - represent list of nodes

func (*NodeList) CreateList

func (n *NodeList) CreateList(o occ.Occurrences)

CreateList - creates linked list from user's input

type TreeNode

type TreeNode struct {
	LeftData       interface{}
	RightData      interface{}
	LeftBranchHas  []rune
	RightBranchHas []rune
	Parent         *TreeNode
	Freq           float64
}

TreeNode - represent node in binary tree

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL