### Binary Tree

Pseudocode

Implementations

Applications

Reading time: 15 minutes | Coding time: 5 minutes

A binary tree is a tree data structure in which each node has upto two children (that is a maximum of two children nodes), which are referred to as the left child and the right child. Node representation is as follows:

The representation of Binary Tree is as follows:

### Pseudocode

Pseudocode of node of a binary tree is as follows:

```
class Node
{
int key;
int val;
BinaryTree left = new BinaryTree();
BinaryTree right = new BinaryTree();
Node (int k, int v)
{
key = k; val = v;
}
}
```

### Implementations

Implementations of Binary Tree is as follows:

- Java

### Java

```
public class Binary_Tree
{
private class Link
{
Node node = null;
}
private class Node
{
int key;
int val;
Link left = new Link();
Link right = new Link();
Node (int k, int v)
{
key = k; val = v;
}
}
Link root = new Link();
}
```

### Applications

Applications of Binary Tree is as follows:

- Manipulate hierarchical data
- Make information easy to search
- Manipulate sorted lists of data
- As a workflow for compositing digital images for visual effects
- Router algorithms
- Form of a multi-stage decision-making