You are on page 1of 18

INSTITUTE:CHANDIGARH UNIVERSUITY

DEPARTMENT: UIC
Bachelor of Computer Application
Subject Name: Data Structure
Code:CAT-201

TREE DISCOVER . LEARN . EMPOWER


Font size 24
SCHEME

Bachelor of Computer Applications Semester – III (2018-21) 


Subject Code Title L T P S Credits
CAT-201 Data Structures 3 0 0 - 3
CAT-202 Database Management System 3 0 0 - 3

CAT-208 Probability & Statistics 3 1 0 - 4


CAT-209 System Software & Operating System 3 0 0 - 3
UCT-249 Introduction to Artificial Intelligence 1 0 0 - 1
TDP-205 Soft Skills 0 0 1 - 1
CAP-206 Data Structures Lab 0 0 4 - 2
CAP-207 Database Management System Lab 0 0 4 - 2

CAY-211 Summer Training/Institutional Training 0 0 0 - 3*


UCY-241 Social and Professional Ethics 2 0 0 - 2*
UCY- 247 Gender Equality and Woman 2 0 0 - 2*
Empowerment
Total 19

2
SYLLABUS
DATA STRUCTURES L T P C
Total Contact Hours:45
CAT- 201 Applicable to which 3 0 0 3
branch: BCA
Prerequisite: Knowledge of Programming in C
Marks
Internal: 40 External: 60
Course Objective
 To learn the systematic way of solving problems.
 To introduce various techniques for representation of the data in the real world
 To efficiently implement solutions for specific problems.
Unit Course Outcome
Student will be able to apply appropriate constructs of Programming language, coding standards for application
1.
development
2. Students will learn to Select and use appropriate data structures for problem solving and programming.
To implement Trees, Graphs and Select appropriate searching and/or sorting techniques for application development
3.
 

3
SYLLABUS
Unit-I
Introduction: Pointers and Dynamic memory allocation, Types of data structures, Mathematical
notation and functions.
Algorithm Analysis: Space Complexity, Time Complexity, Asymptotic Notation and Algorithmic
complexity. Abstract Data Type.
Arrays & Structure: Linear Search, Binary Search (Recursive & iterative, Evaluation of
Polynomial, Polynomial representation, Polynomial Addition).
Structures: Internal representation of structure, Self –referential structure 

4
SYLLABUS
Unit-II
Stack: Memory Representation of Stacks via arrays and Linked List, Stack Operations, Application
of Stack.
Evaluation of Expression: Evaluation of postfix expression, Infix to postfix and prefix forms for
expressions.
Queue: Representation using array and linked List, Queue Operations, Types of queues,
Applications of queue.
Linked List: Representation of linked list, linked list operations (Create, Insertion, Printing,
Deleting and Traversing), Circular Linked List, Double linked list.

5
SYLLABUS
Unit-III
Trees: Definition, Terminology, Representation, Binary tree: Representation and its types, Traversal
(In-order, Pre-order, Post-order). Binary Search Tree, Heap, AVL/Height Balanced Tree
Graphs: Representation of Graphs, Adjacency Matrix and List, In degree, out degree of graph.
Graph operation: Depth First Search and Breath First Search.
Sorting: Bubble sort, Selection sort, Insertion sort, Quick Sort and Merge Sort

6
Course Outcome
CO Number Title Level

CO1 How can we implement Tree data structure? Understand

TREE CO2 Elaborate the operations which we can implement on tree data
structure.
Understand

CO3 Write operations performed on binary search tree. Understand

CO4 Explain the tree data structure applications Understand

CO5 Write an algorithm for Post order traversal. Understand

7
TREE
• Tree represents the nodes connected by edges.
• Binary Tree is a special data structure used for data storage purposes. A binary tree has a special
condition that each node can have a maximum of two children.
• A binary tree has the benefits of both an ordered array and a linked list as search is as quick as in
a sorted array and insertion or deletion operation are as fast as in linked list.

Fig 1 Tree representation


Reference: https://www.tutorialspoint.com/data_structures_algorithms/tree.htm

8
IMPORTANT TERMS IN TREE

Following are the important terms with respect to tree.


• Path − Path refers to the sequence of nodes along the edges of a tree.
• Root − The node at the top of the tree is called root. There is only one root per tree and one path
from the root node to any node.
• Parent − Any node except the root node has one edge upward to a node called parent.
• Child − The node below a given node connected by its edge downward is called its child node.
• Leaf − The node which does not have any child node is called the leaf node.
• Subtree − Subtree represents the descendants of a node.

9
IMPORTANT TERMS IN TREE
• Visiting − Visiting refers to checking the value of a node when control is on the node.
• Traversing − Traversing means passing through nodes in a specific order.
• Levels − Level of a node represents the generation of a node. If the root node is at level 0, then its
next child node is at level 1, its grandchild is at level 2, and so on.
• keys − Key represents a value of a node based on which a search operation is to be carried out for
a node.

10
Binary search tree
Binary Search tree exhibits a special behavior. A node's left child must have a value less than its
parent's value and the node's right child must have a value greater than its parent value.

Fig 2 BST

Reference: https://www.tutorialspoint.com/data_structures_algorithms/tree.htm
11
TREE TRAVERSAL
Traversal is a process to visit all the nodes of a tree and may print their values too. Because, all
nodes are connected via edges (links) we always start from the root (head) node. That is, we cannot
randomly access a node in a tree.
There are three ways which we use to traverse a tree −
• In-order Traversal

• Pre-order Traversal

• Post-order Traversal

12
IN-ORDER TRAVERSAL
• In this traversal method, the left sub-tree is visited first, then the root and later the right sub-tree.
We should always remember that every node may represent a sub-tree itself.
• If a binary tree is traversed in-order, the output will produce sorted key values in an ascending
order.
• We start from A, and following in-order traversal, we move to its left sub-tree B. B is also
traversed in-order. The process goes on until all the nodes are visited. The output of in-order
traversal of this tree will be −
• D→ B →E →A→ F→ C →G

Fig 3 In-order Traversal


https://www.tutorialspoint.com/data_structures_algorithms/tree_traversal.htm

13
PRE-ORDER TRAVERSAL
• In this traversal method, the root node is visited first, then the left subtree and finally the right
subtree.
• We start from A, and following pre-order traversal, we first visit A itself and then move to its left
subtree B. B is also traversed pre-order. The process goes on until all the nodes are visited. The
output of pre-order traversal of this tree will be −
• A→B→D→E→C→F→G

Fig 4 pre-order
https://www.tutorialspoint.com/data_structures_algorithms/tree_traversal.htm
Traversal
14
POST-ORDER TRAVERSAL
In this traversal method, the root node is visited last, hence the name. First we traverse the left sub-
tree, then the right sub-tree and finally the root node.
We start from A, and following pre-order traversal, we first visit the left sub-tree B. B is also
traversed post-order. The process goes on until all the nodes are visited. The output of post-order
traversal of this tree will be −
D→E→B→F→G→C→A

Fig 3 Post-order Traversal

https://www.tutorialspoint.com/data_structures_algorithms/tree_traversal.htm

15
TREE APPLICATIONS
Trees and their variants are an extremely useful data structure with lots of practical applications.
Binary Search Trees(BSTs) are used to quickly check whether an element is present in a set or not.
Heap is a kind of tree that is used for heap sort

16
REFERENCES
Reference Books:
• Seymour Lipschutz, Schaum's Outlines Series Data structures TMH
• Introduction to Data Structures Applications, Trembley&Soreson, Second Edition, Pearson
Education

Reference websites:
• https://www.tutorialspoint.com/data_structures_algorithms

17
THANK YOU

For queries
Email: gurpreetkaur.uic@cumail.in

You might also like