- Tree is a recursive, non-linear data structure consisting of the set of one or more data nodes where one node is designated as the root and the remaining nodes are called as the children of the root.
- Tree organizes data into hierarchial manner.
- The most commonly used tree data structure is a binary tree and its variants.
- Some of the applications of trees are:
- Filesystems —files inside folders that are inturn inside other folders.
- Comments on social media — comments, replies to comments, replies to replies etc form a tree representation.
Family trees — parents, grandparents, children, and grandchildren etc that represents the family hierarchy.
Tree is very flexible, versatile and powerful data structures that can be used to represent data items possessing hierarchical relationship between parent and descendants and in turns descendants and so on.
Tree is non linear data structure in which items/elements are arranged in sorted sequence. It is used to represent hierarchical relationship exist among several data items.
A Graph Theoretic definition of tree is: It is a finite set of one or more data items(nodes) such that:
- There is special data item called ROOT of tree.
- And its remaining data items are partitioned into number of mutually exclusive subsets, each of which is itself a tree, and they are called SUBTREES.