KIET Group of Institutions, Ghaziabad
Department of Computer Science
Subject: Data Structure (BCS301) Year/ Sem: 2nd / 3rd
Session: 2024-25
Assignment-3 Based on Tree & Graph
Starting Date: 20 Nov 2024 Ending Date: 10 Dec 2024
Questions CO BL/KC Marks
Part-1 Two Scenario based Conceptual Questions on Tree:
5 Marks
Attempt any one from A.1 or A.2
A.1) Binary Tree in Expression Evaluation
Scenario: You are designing a calculator that can evaluate mathematical
expressions like (3 + 5) * 2 - 9. How would you use a binary tree to
represent this expression?
Question:
Q-1) Demonstrate how the binary tree can be constructed to represent the
4 3/C 2.5
expression, where operators are internal nodes and operands are leaf
nodes.
Q-2) Define the term Root node, Leaf node, internal node, binary tree, and
its types.
A.2) Binary Search Tree (BST) in a Library Management System:
You are designing a library management system where books need to be
organized by their ISBN numbers for quick search and retrieval.
Questions: 4 3/C 2.5
Q-1) Demonstrate, how would you utilize a Binary Search Tree (BST) to
store and search for books by ISBN?
Q-2) What would be the time complexity of this system?
A.3) Problem No. 112 Path Sum (Leetcode) Easy
Given the root of a binary tree and an integer target Sum, return true if
the tree has a root-to-leaf path such that adding up all the values along
the path equals target Sum.
A leaf is a node with no children.
4 4/P 2.5
Input: root = [5,4,8,11, null,13,4,7,2, null, null, null,1], targetSum =
22
Output: true
Two Scenario based Conceptual Questions on Graph: 5 Marks
B.1) Social Network Connectivity 5 4/P
Scenario: You are developing a social networking app. Each user is
represented as a node, and a friendship between two users is 2.5
represented as an edge.
Questions:
Q-1) Which data structure will be used to represent the above
scenario?
Q-2) How would you determine if two users are connected either
directly or through a chain of friends?
Q-3) What algorithm would you use to find the shortest path between
two users, and why?
B.2) City Traffic Routing
Scenario: A city has multiple intersections (nodes) connected by roads
(edges). To optimize traffic flow, you need to find the shortest path
from a central station to all other intersections. 5 2.5
Questions:
4/P
Q-1) Which algorithm would you choose to implement the solution of
this problem.
Q-2) Also discuss other application of used algorithm.