Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

data structures and algorithms

Rating
-
Sold
-
Pages
42
Uploaded on
29-04-2023
Written in
2022/2023

Its all about data structures and algorithms

Institution
Course

Content preview

DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT




MODULE 4
TREES & GRAPHS




Prepared By Mr. EBIN PM, AP, IESCE 1




TREE
• A tree is a nonlinear data structure. Data elements are related in a
hierarchal manner (parent-child relationship)
• The first node of the tree is called Root node.
• Final nodes are called Leaf nodes.
• Leaf nodes are also called terminal nodes.
• A child has a single parent but a parent has more than one
children. So we can say that , here, a one to many relationship is
exist.
• In a general tree, A node can have any number of children nodes
but it can have only a single parent.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 2




Prepared By Mr. EBIN PM, AP, IESCE

,DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT




• The following image shows a tree, where the node A is the root
node of the tree while the other nodes can be seen as the children
of A.

1




2




3



Prepared By Mr.EBIN PM, AP, IESCE EDULINE 3




BASIC TERMINOLOGY
Root node - topmost node in the tree hierarchy
Sub tree - If the root node is not null, the tree T1, T2 and T3 is called
sub-trees of the root node.
Degree – The number of sub trees of a node. Eg: The degree of A is 3
Siblings - Children of the same parent. Eg: G, H are the siblings of D
Level – If a node is at level l, then its children are at level l+1
Depth – The height or depth of a tree is defined to be the maximum
level of any node in the tree
Forest – If we remove the root of a tree , we get a forest. Eg: If we
remove A, we get a forest with 3 trees.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 4




Prepared By Mr. EBIN PM, AP, IESCE

,DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT




Prepared By Mr.EBIN PM, AP, IESCE EDULINE 5




BINARY TREE
• A binary tree is either empty or consist of a root and 2 disjoint
binary trees called the Left Sub tree and Right Sub tree .

• Each node can have at most two children
• B is the left child of A
• C is the right child of A




Prepared By Mr.EBIN PM, AP, IESCE EDULINE 6




Prepared By Mr. EBIN PM, AP, IESCE

, DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT




TYPES OF BINARY TREE
Strictly Binary Tree – All nodes must have a left child and a right
child except leaf node

• Here B, F , G & E are leaf nodes




Prepared By Mr.EBIN PM, AP, IESCE EDULINE 7




Skewed Binary Tree - It is a special kind of binary tree. Two type
skewed binary trees are Left skewed and Right skewed




• Full Binary Tree - If each node of binary tree has either two
children or no child at all, is said to be a Full Binary Tree. Full binary
tree is also called as Strictly Binary Tree.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 8




Prepared By Mr. EBIN PM, AP, IESCE

Written for

Institution
Course

Document information

Uploaded on
April 29, 2023
Number of pages
42
Written in
2022/2023
Type
Class notes
Professor(s)
Ebin
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
adharshwork40

Get to know the seller

Seller avatar
adharshwork40 MET'S School of Engineering
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
7
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions