# Tree Arity (Binary, Quinary)

## 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="/files/H8ORGQFdkxIPqBqeBnGs" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://battlezips.gitbook.io/battlezips/theory/primitives/merkle-trees/tree-arity-binary-quinary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
