# Binary tree

## 1.Introduction

* The order is not important
* A tree is typical used to present hierarchical structure
* General tree
  * Can have any number of child node
  * Less useful
* Binary tree
  * Can have 0, 1, 2 child node
* Terminology
  * Root, edge, leaf, siblings(same level, same distance from the root node), ancestor, descendent
  * The root node: is an ancestor of every nodes

## 2.Code

* Tree data structure

```
public static class Node<T>
{
    private T data;
    private Node<T> leftChild;
    private Node<T> rightChild;
} 
```


---

# 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://jenhsuan.gitbook.io/algorithm/algorithms-in-a-nutshell/meet-binary-tree-a-hierarchical-data-structure.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.
