Binomial Tree

class pydatastructs.BinomialTree(root=None, order=None)

Represents binomial trees

Parameters
  • root (BinomialTreeNode) – The root of the binomial tree. By default, None

  • order (int) – The order of the binomial tree. By default, None

Examples

>>> from pydatastructs import BinomialTree, BinomialTreeNode
>>> root = BinomialTreeNode(1, 1)
>>> tree = BinomialTree(root, 0)
>>> tree.is_empty
False

References

1

https://en.wikipedia.org/wiki/Binomial_heap

add_sub_tree(other_tree)

Adds a sub tree to current tree.

Parameters

other_tree (BinomialTree) –

Raises

ValueError – If order of the two trees: are different.

property is_empty
root
order
__module__ = 'pydatastructs.miscellaneous_data_structures.binomial_trees'