Binary Tree-Wps Office
Binary Tree-Wps Office
TREE
Definition 1
Index Type of tree
2
Memory Representation 23
Traversing of tree
4
Application of tree
5
Definition:-
•A binary tree is a non-linear linked list where each node may point
to two other nodes.
Every node in a binary tree can
have at most two children.
The two children of each node are
called the left child and right child
corresponding to their positions.
A node can have only a left child or
only a right child or it can have no
children at all.
Left child is always less that its
parent, while right child is greater
than its parent.
•A node that has no children is
called a leaf node.
•All pointers that do not point to a node
are set to NULL.
BINARY TREE
Binary trees can be divided into subtrees. A subtree is an entire
branch of the tree, from one particular node down.
6
Types of Binary Tree
Following are common types of Binary Trees.
Representation of a node:
n this representation of binary tree root will contain the location of the root R
of T. If any one of the subtree is empty, then the corresponding pointer will
contain the null value if the tree T itself is empty, the ROOT will contain the
null value.
Example:-
Consider the binary tree T in the figure. A schematic diagram of the linked
list representation of T appears in the following figure. Observe that each
node is pictured with its three fields, and that the empty subtree is pictured
by using x for null entries.
2)Sequential representation of
Binary Tree
Let us consider that we have a tree T. let our tree T is a binary tree
that us complete binary tree. Then there is an efficient way of
representing T in the memory called the sequential representation or
array representation of T. This representation uses only a linear
array TREE as follows:
16
1. The node’s data is processed.
2. The node’s left subtree is traversed.
3. The node’s right subtree is traversed.
17
1. The node’s left subtree is traversed.
2. The node’s right subtree is traversed.
3. The node’s data is processed.
18
Applications of Binary Trees
•Binary trees are excellent data structures for searching large
amounts of information. They are commonly used in database
applications to organize key values that index database records.
•When used to facilitate searches, a binary tree is called a binary
search tree.
THANK
YOUS