Binary Tree
Binary Tree is a non-linear data structure. It is made up of nodes. Each node can hold a maximum of two nodes, Left and Right. It is to represent hierarchical information.
A node that has no parent is called Root. A link from parent to a child node is called Edge. A node that has the same level as some nodes are called Sibling. A node that has no children is called Leaf.
![Binary Tree](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Binary_tree.svg/600px-Binary_tree.svg.png)
Traversal
Visiting every node is called Traversal. There are two order types; Breadth-First and Depth-First.
Breadth-First
Visiting every node at the same level before moving to the next level.
![Breadth-First](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d1/Sorted_binary_tree_breadth-first_traversal.svg/532px-Sorted_binary_tree_breadth-first_traversal.svg.png)
Depth-First
Visiting every node with going deep to the leaf before moving to the next node of the same level and can be performed in three ways; Pre-Order, In-Order, and Post-Order.
Pre-Order
The left subtree has processed before the right subtree.
![Pre-Order](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4/Sorted_binary_tree_preorder.svg/672px-Sorted_binary_tree_preorder.svg.png)
In-Order
Similar to Pre-Order. But, start from the Leaf to the upper level of the node.
![In-Order](https://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Sorted_binary_tree_inorder.svg/672px-Sorted_binary_tree_inorder.svg.png)
Post-Order
Similar to In-Order. But, instead of going to the upper level first, it is moving to the node of the same level first.
![Post-Order](https://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/Sorted_binary_tree_postorder.svg/672px-Sorted_binary_tree_postorder.svg.png)