⇰ TREE :-
A tree is an ideal data structure for representing hierarchical data. A tree can be theoretically defined as a finite set of one or more nodes or data items such that :-
i > There is a special node called the root of the tree.
ii > All nodes are partitioned into number of nodes each of which is itself a tree, are called sub tree.
⇰ APPLICATION OF TREES :-
⇰ BASIC TERMINOLOGIES :-
Node :- It contains a key or value and pointers to its child nodes. The first node is called root node and the last nodes of each path are called leaf nodes that do not contain a link/pointer to child nodes. The node having at least a child node is called an internal node.
Edge :- The edge is the link between any two nodes. It means every node is connected to other nodes with the help of edges.
Height :- The height of a node is the number of edges from the node to the deepest leaf . It is the longest path from the node to a leaf node.
Depth :- The depth of a node is the number of edges from the root to the node.
Degree :- The number of a node is the total number of branches of that node.
⇰ TYPES OF TREE :-
There are many kinds of tree data structure but we will discuss here few of them which are as follows :-
i > General Tree.
ii > Binary Tress.
iii > Binary Search Tree.
iv > AVL Tree.
i > General Tree :- If no any constraint is applied on the hierarchy of the tree then that tree can said to be general tree. Every node may have infinite number of children in general tree. This type of tree is the super-set of all other trees. This is the simplest type of tree.
ii > Binary Tree :- A tree in which every node can have maximum of two children is called as Binary Tree.. In binary tree that two children are known as Left child and Right Child. It is also a method of placing and locating the records in a database.
Here A is root node and B & C are child of A . Again B have one child D and C have two child E & F. We can see here every node have maximum of two children only so this tree is binary tree.
iii > Binary Search Tree :- Binary Search Tree is a binary tree where all nodes of left subtree are less than root node , all nodes of right subtree are more than root node and both subtrees of each node are also binary search trees.
Here 10 is considered as root node and children are 6 and 18. 6 is connected on left as 6 is smaller then 10 and 18 is connected on right as 18 is greater than 10 and so on.
iv > AVL Tree :- An AVL is balanced binary search tree named after their inventors, Adelson-Velskii and Landis. In AVL tree the sub-trees of every node differ in height by atmost one and every sub-tree is an AVL tree.
TYPES OF BINARY TREE :- https://priypurnea.blogspot.com/2020/04/types-of-binary-tree.html
Keep connected and comment for detailed discussion on each type of tree seperately.
Follow (follow option is on the top right 3 line icon) and please comment if you find anything incorrect, or to share more information about the topic discussed above.
Tree is one of the important non-liner data structure in computer science. Many real life problems can be represented and solved using trees. Trees are very flexible, versatile and powerful non-liner data structure that can be used to represent data items possessing hierarchical.
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.
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.
A tree is an ideal data structure for representing hierarchical data. A tree can be theoretically defined as a finite set of one or more nodes or data items such that :-
i > There is a special node called the root of the tree.
ii > All nodes are partitioned into number of nodes each of which is itself a tree, are called sub tree.
⇰ APPLICATION OF TREES :-
∗ Easy to search data by traversal.
∗ Manipulate hierarchical data as well as sorted lists of data.
∗ Manipulate hierarchical data as well as sorted lists of data.
∗ Used in Router algorithms.
∗ Form of a multi-stage decision-making.
⇰ BASIC TERMINOLOGIES :-
Node :- It contains a key or value and pointers to its child nodes. The first node is called root node and the last nodes of each path are called leaf nodes that do not contain a link/pointer to child nodes. The node having at least a child node is called an internal node.
Edge :- The edge is the link between any two nodes. It means every node is connected to other nodes with the help of edges.
Height :- The height of a node is the number of edges from the node to the deepest leaf . It is the longest path from the node to a leaf node.
Depth :- The depth of a node is the number of edges from the root to the node.
Degree :- The number of a node is the total number of branches of that node.
Forest :- The collection of many disjoint trees is called forest.
⇰ TYPES OF TREE :-
There are many kinds of tree data structure but we will discuss here few of them which are as follows :-
i > General Tree.
ii > Binary Tress.
iii > Binary Search Tree.
iv > AVL Tree.
i > General Tree :- If no any constraint is applied on the hierarchy of the tree then that tree can said to be general tree. Every node may have infinite number of children in general tree. This type of tree is the super-set of all other trees. This is the simplest type of tree.
ii > Binary Tree :- A tree in which every node can have maximum of two children is called as Binary Tree.. In binary tree that two children are known as Left child and Right Child. It is also a method of placing and locating the records in a database.
Here A is root node and B & C are child of A . Again B have one child D and C have two child E & F. We can see here every node have maximum of two children only so this tree is binary tree.
iii > Binary Search Tree :- Binary Search Tree is a binary tree where all nodes of left subtree are less than root node , all nodes of right subtree are more than root node and both subtrees of each node are also binary search trees.
Here 10 is considered as root node and children are 6 and 18. 6 is connected on left as 6 is smaller then 10 and 18 is connected on right as 18 is greater than 10 and so on.
iv > AVL Tree :- An AVL is balanced binary search tree named after their inventors, Adelson-Velskii and Landis. In AVL tree the sub-trees of every node differ in height by atmost one and every sub-tree is an AVL tree.
TYPES OF BINARY TREE :- https://priypurnea.blogspot.com/2020/04/types-of-binary-tree.html
Keep connected and comment for detailed discussion on each type of tree seperately.
Follow (follow option is on the top right 3 line icon) and please comment if you find anything incorrect, or to share more information about the topic discussed above.
Thanku for this... It is very helpful.. I need this
ReplyDelete