0% found this document useful (0 votes)
41 views

Data Structure - CS3301 - Important Questions With Answer - Unit 3 - Trees

Uploaded by

Saravanan DP
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Data Structure - CS3301 - Important Questions With Answer - Unit 3 - Trees

Uploaded by

Saravanan DP
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Click on Subject/Paper under Semester to enter.

Environmental Sciences
Professional English and Sustainability -
Professional English - - II - HS3252 Discrete Mathematics GE3451
I - HS3152 - MA3354
Statistics and Theory of Computation
Matrices and Calculus Numerical Methods - Digital Principles and - CS3452
3rd Semester

4th Semester
- MA3151 MA3251 Computer Organization
1st Semester

2nd Semester

- CS3351 Artificial Intelligence


Engineering Graphics and Machine Learning
Engineering Physics - - CS3491
- GE3251 Foundation of Data
PH3151
Science - CS3352
Database Management
Physics for
Engineering Chemistry System - CS3492
Information Science Data Structure -
- CY3151 - PH3256 CS3301

Basic Electrical and


Algorithms - CS3401
Problem Solving and Electronics Engineering Object Oriented
Python Programming - - BE3251 Programming - CS3391 Introduction to
GE3151 Operating Systems -
Programming in C -
CS3451
CS3251

Computer Networks - Object Oriented


CS3591 Software Engineering
- CCS356
Compiler Design - Human Values and
5th Semester

CS3501 Embedded Systems Ethics - GE3791


7th Semester

8th Semester
6th Semester

and IoT - CS3691


Cryptography and Open Elective 2
Cyber Security - Open Elective-1 Project Work /
CB3491
Open Elective 3 Intership
Distributed Computing Elective-3
- CS3551 Open Elective 4
Elective-4
Elective 1
Management Elective
Elective-5
Elective 2
Elective-6
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to
enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering
www.BrainKart.com Page 1 of 6

4931_Grace College of Engineering, Thoothukudi

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

BE- Computer Science and Engineering

Anna University Regulation: 2021

CS3301 – DATA STRUCTURES

II Year/III Semester

QUESTION BANK (2 Marks & 16 Marks)

UNIT -3 (TREES)

Prepared By,

Mrs. K.M.ANNAMMAL, AP/CSE

CS3301_DS

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
www.BrainKart.com Page 2 of 6

4931_Grace College of Engineering, Thoothukudi

TWO MARKS
1. Define a tree
A tree is a collection of nodes. The collection can be empty; otherwise, a tree
consists of a distinguished node r, called the root, and zero or more nonempty
(sub) trees T1, T2,…,Tk, each of whose roots are connected by a directed edge
from r.
2. Define root
This is the unique node in the tree to which further sub-trees are attached.

B
C

Here, A is the root.


3. Define degree of the node
The total number of sub-trees attached to that node is called the degree of the
node.

For node A, the degree is 2 and for B and C, the degree is 0.


4. Define leaves
These are the terminal nodes of the tree. The nodes with degree 0 are always
the leaves.

Here, B and C are leaf nodes. 9

CS3301_DS

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
www.BrainKart.com Page 3 of 6

4931_Grace College of Engineering, Thoothukudi

5. Define internal nodes


The nodes other than the root and the leaves are called internal nodes.

B C

D E

Here, C is the internal node.


6. Define parent node
The node which is having further sub-branches is called the parent node of
those sub-branches.

Here, node C is the parent node of D and E


7. Define depth and height of a node
For any node ni, the depth of ni is the length of the unique path from the root
to ni. The height of ni is the length of the longest path from ni to a leaf.
8. Define depth and height of a tree
The depth of the tree is the depth of the deepest leaf. The height of the tree is
equal to the height of the root. Always depth of the tree is equal to height of
the tree.
9. What do you mean by level of the tree?

CS3301_DS

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
www.BrainKart.com Page 4 of 6

4931_Grace College of Engineering, Thoothukudi

The root node is always considered at level zero, then its adjacent children
are supposed to be at level 1 and so on. Here, node A is at level 0, nodes B
and C are at level 1 and nodes D and E are at level 2.
10.Define forest
A tree may be defined as a forest in which only a single node (root) has no
predecessors. Any forest consists of a collection of trees.
11.Define a binary tree
A binary tree is a finite set of nodes which is either empty or consists of a root
and two disjoint binary trees called the left sub-tree and right sub-tree.
12.Define a path in a tree
A path in a tree is a sequence of distinct nodes in which successive nodes are
connected by edges in the tree.
13.Define a full binary tree
A full binary tree is a tree in which all the leaves are on the same level and
every non-leaf node has exactly two children.
14.Define a complete binary tree
A complete binary tree is a tree in which every non-leaf node has exactly two
children not necessarily to be on the same level.
15.State the properties of a binary tree
• The maximum number of nodes on level n of a binary tree is 2n-1, where
n≥1. • The maximum number of nodes in a binary tree of height n is 2n-1,
where n≥1. • For any non-empty tree, nl=nd+1 where nl is the number of leaf
nodes and nd is the number of nodes of degree 2.
16.What is meant by binary tree traversal?
Traversing a binary tree means moving through all the nodes in the binary
tree, visiting each node in the tree only once.
17.What are the different binary tree traversal techniques?
• Preorder traversal • Inorder traversal • Postorder traversal • Levelorder
traversal
18.What are the tasks performed during inorder traversal?
• Traverse the left sub-tree • Process the root node • Traverse the right sub-
tree
19.What are the tasks performed during postorder traversal?
• Traverse the left sub-tree • Traverse the right sub-tree • Process the root
node
20.State the merits of linear representation of binary trees
. • Storage method is easy and can be easily implemented in arrays • When the
location of a parent/child node is known, other one can be determined easily
• It requires static memory allocation so it is easily implemented in all
programming language

CS3301_DS

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
www.BrainKart.com Page 5 of 6

4931_Grace College of Engineering, Thoothukudi

21.State the demerit of linear representation of binary trees.


Insertions and deletions in a node take an excessive amount of processing time
due to data movement up and down the array.
22.State the merit of linked representation of binary trees.
Insertions and deletions in a node involve no data movement except the
rearrangement of pointers, hence less processing time.
23.State the demerits of linked representation of binary trees.
• Given a node structure, it is difficult to determine its parent node • Memory
spaces are wasted for storing null pointers for the nodes, which have one or
no sub-trees • It requires dynamic memory allocation, which is not possible in
some programming language
24.Define a binary search tree
A binary search tree is a special binary tree, which is either empty or it should
satisfy the following characteristics: Every node has a value and no two nodes
should have the same value i.e) the values in the binary search tree are distinct
• The values in any left sub-tree is less than the value of its parent node • The
values in any right sub-tree is greater than the value of its parent node • The
left and right sub-trees of each node are again binary search trees
25.What is the use of threaded binary tree?
In threaded binary tree, the NULL pointers are replaced by some addresses.
The left pointer of the node points to its predecessor and the right pointer of
the node points to its successor.

26.Traverse the given tree using Inorder, Preorder and Postorder traversals.

B
C

D E F G

Inorder : D H B E A F C I G J
Preorder: A B D H E C F G I J
Postorder: H D E B F I J G C A

CS3301_DS

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
www.BrainKart.com Page 6 of 6

4931_Grace College of Engineering, Thoothukudi

27.Define AVL Tree.


An empty tree is height balanced. If T is a non-empty binary tree with TL and
TR as its left and right subtrees, then T is height balanced if i) TL and TR are
height balanced and ii) │hL - hR│≤ 1 Where hL and hR are the heights of TL
and TR respectively.
28.What do you mean by balanced trees?
Balanced trees have the structure of binary trees and obey binary search tree
properties. Apart from these properties, they have some special constraints,
which differ from one data structure to another. However, these constraints
are aimed only at reducing the height of the tree, because this factor
determines the time complexity. Eg: AVL trees, Splay trees.

PART -B
1. Explain the heap tree ADT in detail
2. Identify the types of priority queue. Explain about min heap insertion and
deletion operation
3. Outline Preorder, inorder and postorder traversals on a binary tree with an
algorithm and an example
4. State the binary search tree property and outline the algorithm to search a
binary search tree with an example

CS3301_DS

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
Click on Subject/Paper under Semester to enter.
Professional English Discrete Mathematics Environmental Sciences
Professional English - - II - HS3252 - MA3354 and Sustainability -
I - HS3152 GE3451
Digital Principles and
Statistics and Probability and
Computer Organization
Matrices and Calculus Numerical Methods - Statistics - MA3391
- CS3351
- MA3151 MA3251
3rd Semester
1st Semester

4th Semester
2nd Semester

Database Design and Operating Systems -


Engineering Physics - Engineering Graphics
Management - AD3391 AL3452
PH3151 - GE3251

Physics for Design and Analysis of Machine Learning -


Engineering Chemistry Information Science Algorithms - AD3351 AL3451
- CY3151 - PH3256
Data Exploration and Fundamentals of Data
Basic Electrical and
Visualization - AD3301 Science and Analytics
Problem Solving and Electronics Engineering -
BE3251 - AD3491
Python Programming -
GE3151 Artificial Intelligence
Data Structures Computer Networks
- AL3391
Design - AD3251 - CS3591

Deep Learning -
AD3501

Embedded Systems
Data and Information Human Values and
and IoT - CS3691
5th Semester

Security - CW3551 Ethics - GE3791


6th Semester

7th Semester

8th Semester

Open Elective-1
Distributed Computing Open Elective 2
- CS3551 Project Work /
Elective-3
Open Elective 3 Intership
Big Data Analytics - Elective-4
CCS334 Open Elective 4
Elective-5
Elective 1 Management Elective
Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering
Click on Subject/Paper under Semester to enter.
Environmental Sciences
Professional English and Sustainability -
Professional English - - II - HS3252 Discrete Mathematics GE3451
I - HS3152 - MA3354
Statistics and Theory of Computation
Matrices and Calculus Numerical Methods - Digital Principles and - CS3452
3rd Semester

4th Semester
- MA3151 MA3251 Computer Organization
1st Semester

2nd Semester

- CS3351 Artificial Intelligence


Engineering Graphics and Machine Learning
Engineering Physics - - CS3491
- GE3251 Foundation of Data
PH3151
Science - CS3352
Database Management
Physics for
Engineering Chemistry System - CS3492
Information Science Data Structure -
- CY3151 - PH3256 CS3301

Basic Electrical and


Algorithms - CS3401
Problem Solving and Electronics Engineering Object Oriented
Python Programming - - BE3251 Programming - CS3391 Introduction to
GE3151 Operating Systems -
Programming in C -
CS3451
CS3251

Computer Networks - Object Oriented


CS3591 Software Engineering
- CCS356
Compiler Design - Human Values and
5th Semester

CS3501 Embedded Systems Ethics - GE3791


7th Semester

8th Semester
6th Semester

and IoT - CS3691


Cryptography and Open Elective 2
Cyber Security - Open Elective-1 Project Work /
CB3491
Open Elective 3 Intership
Distributed Computing Elective-3
- CS3551 Open Elective 4
Elective-4
Elective 1
Management Elective
Elective-5
Elective 2
Elective-6
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to
enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering
Click on Subject/Paper under Semester to enter.
Environmental Sciences
Professional English and Sustainability -
Professional English - - II - HS3252 Discrete Mathematics - GE3451
I - HS3152 MA3354
Statistics and Theory of Computation
Matrices and Calculus Numerical Methods - Digital Principles and - CS3452
3rd Semester

4th Semester
- MA3151 MA3251 Computer Organization
1st Semester

2nd Semester

- CS3351 Artificial Intelligence


Engineering Graphics and Machine Learning
Engineering Physics - - CS3491
- GE3251 Foundation of Data
PH3151
Science - CS3352
Database Management
Physics for
Engineering Chemistry System - CS3492
Information Science Data Structures and
- CY3151 - PH3256 Algorithms - CD3291
Web Essentials -
Basic Electrical and IT3401
Problem Solving and Electronics Engineering - Object Oriented
Python Programming - BE3251 Programming - CS3391 Introduction to
GE3151 Operating Systems -
Programming in C -
CS3451
CS3251

Computer Networks -
CS3591
Object Oriented
Full Stack Web Software Engineering - Human Values and
5th Semester

Development - IT3501 CCS356 Ethics - GE3791


7th Semester

8th Semester
6th Semester

Distributed Computing Open Elective-1 Open Elective 2


- CS3551 Project Work /
Elective-3 Open Elective 3 Intership
Embedded Systems and
IoT - CS3691 Elective-4
Open Elective 4

Elective 1 Elective-5
Management Elective

Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering

You might also like