What is Tree?
A tree data structure is a non-linear data structure because it does not store in a sequential manner. It is a hierarchical structure consisting of a collection of nodes such that each node of the tree stores a value and a list of references to other nodes (the “children”).
Why we need Tree as Data-Structure?
Other data structures such as arrays, linked list, stack, and queue are linear data structures that store data sequentially. In order to perform any operation in a linear data structure, the time complexity increases with the increase in the data size. But, it is not acceptable in today’s computational world.
Different tree data structures allow quicker and easier access to the data as it is a non-linear data structure.