> For the complete documentation index, see [llms.txt](https://battlezips.gitbook.io/battlezips/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://battlezips.gitbook.io/battlezips/theory/primitives/merkle-trees/tree-arity-binary-quinary.md).

# Tree Arity (Binary, Quinary)

Overview of tree arity and why it matters in the context of a Merkle Tree

## What is tree arity?

Arity is how many children descend from a parent node in a tree. The most common implementation is the binary tree. Trees can have any arbitrary arity depending on the specific use case however. Why does it matter in Merkle Trees though?

## Why does it matter in a Merkle Tree?

When updating Merkle Trees on chain it can result in significant gas costs depending on the depth of the tree. To decrease gas costs a solution is to implement a SNARK friendly hashing functions that produces less constraints with higher arity. PoseidonT6 namely is one such function

<figure><img src="https://1091404591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fu3R2CTByhos1Cr9t3iOB%2Fuploads%2F0riZC9codA5YIg44lZ9L%2Fnary_tree.png?alt=media&amp;token=49d4114a-14cc-404a-97bb-71c7684fdc07" alt=""><figcaption></figcaption></figure>
