Describe the tree data structure- What is a root node- What is a child.docx

18 views 2 slides Jan 31, 2023
Slide 1
Slide 1 of 2
Slide 1
1
Slide 2
2

About This Presentation

Describe the tree data structure. What is a root node? What is a child node? What is a leaf node? What is a subtree? What is the height of a tree? When is a tree full? When is a tree balanced? What is breadth-first traversal? What are the common methods for traversing a binary tree and processing th...


Slide Content

Describe the tree data structure. What is a root node? What is a child node? What is a leaf node?
What is a subtree? What is the height of a tree? When is a tree full? When is a tree balanced?
What is breadth-first traversal? What are the common methods for traversing a binary tree and
processing the value of each node?
Solution
A tree is a special type of a graph where the tree contains the nodes and connected by means
edges and doesnot have loops.
root node :the node or vertex at the top of a tree is termed as root node.
child node :the nodes that are below the rootnode or any particular node is termedas the child
node.
leaf node :the node which doesnot possess any children node is defined as leaf node
subtree :the part of a tree is called subtree or the descendents of a tree.
height of a tree:is the number of edges from the leaf node to the root node.
full tree :full tree is binary tree all the nodes have two child nodes except the leaf nodes.
tree balanced :an AVL tree is said to balanced tree if the balancing factor ranges from -1 to +1
breadth first traversal :travelling the nodes of a tree in breadth wise manner that is all the
nodes at the same height are travelled sequentially and then their childs are travelled.queue is
used to travell in breadth first search
common ways of traversing are :1)breadth first search
2)depth first search
Tags