Trees Binary trees are basically like a normal tree, a tree has branches and each branch can be connected to more branch. In the end there are leaves. You can imagine the same to be a form of a tree

Node is like a Branching Point in tree which actually is the heart of the data store in a tree. Any node will contain value which could be any type of data_type like, int, string or object or list of objects. Then there are the pointers to the other node from the current node.

A binary tree is a structure where there are only 2 branches to any node namely the left and right node.

Common use cases of using trees are Indexes in Database, Product Catalog, Expressions for RegEx, Code compilation etc.

Sample Code for 2 common type of trees are given below

Sorted Binary Tree  It is special binary tree, where the values in left are always lesser that the right end. It can be helpful in building databases indexes. It takes approximately O(log(N)) times for any data insert as the entire tree need not be searched through.

Generic Binary Tree Here the data is always inserted in the breadth first search (BFS) mode. Here the data is always inserted in the order in which data comes. It will take approximately O(N) time to do any insert.