Updated DSU Master Solution
Updated DSU Master Solution
“MASTER SOLUTIONs”
Semester – CO3K
https://services.msbte.ac.in/scheme_digi/fetch_scheme_api_print 1/1
7/22/24, 2:00 PM 313301-DATA STRUCTURE USING C
I. RATIONALE
One of the most important courses in information and communication technology is data structures. Data
organization or structuring is essential for developing effective algorithms and programs. Students will get the
ability to develop logic to solve problem using principles of data structure with the aid of this course.
1. FA-TH represents average of two class tests of 30 marks each conducted during the semester.
2. If candidate is not securing minimum passing marks in FA-PR of any course then the candidate shall be
declared as "Detained" in that semester.
3. If candidate is not securing minimum passing marks in SLA of any course then the candidate shall be
declared as fail and will have to repeat and resubmit SLA work.
4. Notional Learning hours for the semester are (CL+LL+TL+SL)hrs.* 15 Weeks
5. 1 credit is equivalent to 30 Notional hrs.
6. * Self learning hours shall not be reflected in the Time Table.
7. * Self learning includes micro project / assignment / other activities.
X. ASSESSMENT METHODOLOGIES/TOOLS
Continuous Assessment based on Process and Product related Performance Indicators. Each practical will be
assessed considering 60% weightage to Process and 40% weightage to Product
Teachers are requested to check the creative common license status/financial implications of the suggested
online educational resources before use by the students
https://services.msbte.ac.in/scheme_digi/pdfdownload/download/ 6/6
JSPM's
Rajarshi Shahu College of Engineering,
Polytechnic, Tathawade, Pune-33
Academic Year 2024-25
Marks
Marks Marks Marks Marks Marks Marks Marks Marks
as per
weight weight weight weight weight weight weight weight
Unit Teachi
No.
age in age in age in age in age in age in age in age in
ng
S-24 W-23 S-23 W-22 S-22 W -19 S-19 W-18
Schem
QP QP QP QP QP QP QP QP
e
Unit 8
No. 1
4 4 8 6 4 4 8 8
Unit 14
No. 2
12 20 16 20 14 14 18 18
Unit 24
No. 3
16 30 18 18 18 24 24 24
Unit 20
No. 4
12 16 22 20 22 18 24 18
Unit 10
No. 5
10 8 8 12 8 12 06 12
Unit 18
No. 6
16 10 16 14 12 10 12 16
Total
Marks
70 94 88 88 90 78 82 92 96
Out of syllabus 8 14 10 12 18 20 10 06
1
Sr.
Questions Year Marks
No.
Summer-24,
1 Define Abstract Data Type (ADT) winter-22, 2
Summer 22
Summer-24,
Winter 23,
2 List the operation that can be performed on data structure. summer 23, 2
Winter 19,
Summer 19
Data structure operations:
• Insertion: Adding a new data.
• Deletion: Removing a data.
• Sorting: Arranging the data in some logical order.
• Searching: Finding the location of data.
• Traversal: Accessing each data exactly once.
Merging: Combining the data.
Winter 23,
Define the terms: Linear data structure and non-linear data
Summer 23,
4 structure 2
Summer 22,
Explain linear and non-linear data structures
Winter 18
Linear Data Structure
A data structure in which all data elements are stored in a particular sequence is
known as linear data structure.
Non-Linear data structure
A data structure in which all data elements are not stored in any particular
sequence is known as nonlinear data structure.
5 Implement a C program to insert an element in an array Summer 23 4
Differentiate between linear and non-linear data structure. (any four Winter- 22
6 4
points) Summer 19
Sr.
Questions Year Marks
No
Winter 23,
Summer
1 State any two differences between linear search and binary search 2,4
23,
Summer19
Winter 23,
4 Describe working of bubble sort with example Summer 22 4
,Winter 18
In bubble sort, sorting begins with comparison of 0th index element with 1st index
element in the list. If 0th index element is greater than 1st index element then numbers
are interchanged. In this way, all elements are compared with its next element &
interchanged if required. At the end of 1st pass, the largest element from the list is placed
at the last position in an array. In pass 2, again comparison starts with 0th index element
and 1st index element. If required then elements are interchanged. At the end of pass2,
2nd largest element is placed at its final position. This process of comparison and
interchange continue in all passes.
In every pass numbers of comparisons are reduced by one, as an element placed at its
final position from bottom is not compared in next pass. This process continues till all
elements are placed in sorted order.
Sort the following number in ascending order using bubble sort. Given
5 Winter 23 6
numbers as follows: 475, 15, 513, 6753, 45, 118.
Summer
6 Define Searching. What are its types? 2
23
Find the position of element 29 using Binary search method in an array Summer
8 6
given as: {11,5,21,3,29,17,2,43} 23
int main() {
int arr[]
= {64, 34, 25, 12, 22, 11, 90};
int n = sizeof(arr) / sizeof(arr[0]);
bubbleSort(arr, n);
Write a ‘C’ program for insertion sort. Sort the following array using
13 Winter 22 6
insertion sort : 30, 10, 40, 50, 20, 45
Find the position of element 30 using Binary search method in array Summer
14 4
A = {10, 5, 20, 25, 8, 30, 40} 22
Describe the working of Selection Sort Method. Also sort given input list in Summer
15 6
ascending order using selection sort. Input list: 50, 24, 5, 12, 30 22
Selection sort is a simple sorting algorithm that works by repeatedly finding the
minimum element from unsorted part and putting it at the beginning.
How it works:
1. Find the minimum element in the unsorted array.
2. Swap the found minimum element with the first element.
3. Repeat the above steps for the remaining unsorted array.
Implement a ‘C’ program to search a particular data from the given array
16 Winter-19 4
using Linear Search.
Find the position of element 21 using Binary Search method in Array ‘A’
17 Winter-19 4
given below : A = {11, 5, 21, 3, 29, 17, 2, 45}
Elaborate the steps for performing selection sort for given elements of
18 Winter-19 6
array. A = {37, 12, 4, 90, 49, 23, –19}
Summer-
19 Explain the working of Binary search with an example. 4
19
Sort the following numbers in ascending order using quick sort. Given Summer-
20 4
numbers 50, 2, 6, 22, 3, 39, 49, 25, 18, 5. 19
Sort the following numbers in ascending order using Bubble sort. Given
Summer-
21 numbers : 29, 35, 3, 8, 11, 15, 56, 12, 1, 4, 85, 5 & write the output after 6
19
each interaction.
Find the position of element 29 using binary search method in an array ‘A’
23 Winter-18 4
given below. Show each step. A = {11, 5, 21, 3, 29, 17, 2, 43}
Describe working of selection sort method. Also sort given input list in
24 Winter-18 6
ascending order using selection sort input list – 55, 25, 5, 15, 35.
QUESTION BANK
Sr.
Questions Year Marks
No.
Summer
1 Define linked list with example 2
24
Explain the concept of information, next, null pointer and empty list with respect Summer
2 4
to linked list 24
Describe the concept of linked list with the terminologies: node, next pointer, null
pointer and empty list.
Winter-
3 18
4
Summer
4 Write an algorithm to insert a new node at the beginning in linear list 24, 4
Winter 22
Summer
5 Explain the operation on a singly linked list 24, 4
Winter 23
Summer
6 Compare linear list with circular list (Any four points) 24
4
Create a singly linked list using data fields 15,20,22,58,60. Search a node 22 from the
Summer
7 singly linked list and show procedure step-by-step with the help of diagram from start 6
24
to end
Winter
23,
9 Write algorithm to delete an intermediate node from a singly linked list. Summer
4
23
Create singly linked list using data fields 10, 20, 30, 40, 50 and show step by step
10 Winter 23 4
procedure with the help of diagram from start to end.
11 Describe advantages of circular link list over linear link list with example Winter 23 4
Describe circular linked list with suitable diagram. State advantages of circular linked Summer
12 22
6
list over linear linked list
Describe circular linked list with suitable diagram. Also state advantage of circular Winter-
13 18
4
linked list over linear linked list.
Summer-
15 Write an algorithm to delete a node at the beginning from a singly linked list. 4
23
Create a singly Linked list using data fields 10,20,30,40,50 and show procedure step by Summer-
16 23
4
step with help of diagram from start to end
Create a singly Linked list using data fields 10,20,30,40,50. Search a node 40 from the
Summer-
17 singly linked list and show procedure step by step with help of diagram from start to 6
23
end
Explain node structure for single linked list. Also write advantages of singly list over Winter-
18 4
array. (any Two) 22
Winter-
19 Compare linear list with circular list. 4
22
Write the ‘C’ function for :i) searching a node in single linked list. ii) counting number Winter-
20 22
6
of nodes in single linked list.
Summer
21 Write an algorithm to search an element in linked list. 6
22
Winter-
22 Write an algorithm to search a particular node in the given linked list. 6
19
Summer-
23 Write an algorithm to count number of nodes in singly linked list. 6
19
Winter-
24 Write an algorithm to count number of nodes in singly linked list. 4
18
Summer
25 Write an algorithm to traverse a linked list. 4
22
Write an algorithm to insert a new node at the beginning of a Singly linked list. Give Summer
26 22
4
example.
Write an algorithm to insert a new node at the beginning and end of the singly linked Winter-
27 19
4
list.
Construct a singly linked list using data fields 21, 25, 96, 58, 74 and show procedure Winter-
28 19
4
step-by-step with the help of diagram start to end.
Winter-
29 Compare Linked List and Array. (any 4 points) 19
4
Show with suitable diagrams how to delete a node from singly linked list at the Winter-
30 6
beginning, in between and at the end of the list. 19
Summer-
31 Write a program to traverse a linked list. 4
19
Create a singly linked list using data fields 15, 20, 22, 58, 60. Search a node 22 from Summer-
32 4
the SLL and show procedure step-by-step with the help of diagram from start to end. 19
Summer-
33 Write an algorithm to delete a node from the beginning of a circular linked list. 19
4
Create a singly linked list using data fields 90, 25, 46, 39, 56. Search a node 40 from Summer-
34 19
6
the SLL and show procedure step-by-step with the help of diagram from start to end.
Winter-
35 Write an algorithm to insert an element at the beginning and at end of linked list. 6
18
Winter-
36 Describe procedure to delete an element from singly linked list using diagram. 6
18
QUESTION BANK
CO.4: Perform operation on Stack using Array and Linked List Implementation
Sr.
Questions Year Marks
No.
Summer
1 Define stack with suitable example. 2
24
Summer
2 Explain PUSH and POP operation on stack with suitable example 4
24
Summer
3 Write a program to print a string in reverse order 4
24
Summer
24,
Convert the following infix expression to postfix expression using stack and show the Summer
4 4
details of stack in each step : ((A+B)*C)^(D-E) 23,
Winter
19
Evaluate the given infix expression to the postfix expression using stack: Summer
5 6
((a/(b- c+d))*(e-a)*c) 24
Convert the following infix expression to its postfix form using stack: A + B – C * D / Winter
6 2
E+F 23
Convert the given infix expression to postfix expression using stack and the details of Winter
7 4
stack at each step of conversion Expression: A * B C – D / E +[F / G] 23
Show the effect of PUSH and POP operation on the stack of size 10. The stack contains
10, 20, 25, 15, 30 and 40 with 40 being at top of stack. Show diagrammatically the Winter
8 4
effect of 23
i) PUSH (45) ii) PUSH (50) iii) POP iv) PUSH (55)
Summer
10 Write any two-operation performed on the stack 2
23
Summer
20 Enlist operations on stack. 2
22
1. PUSH ()
2. POP ()
Summer
11 Explain stack overflow and underflow condition with example. 4
23
Show the effect of PUSH and POP operation on to the stack of size 10. The stack
contains 10, 20,30,40,50, and 60, with 60 being at top of the stack. Show
diagrammatically the effect of-
i) PUSH 55 Summer
12 4
ii) PUSH 70 23
iii) POP
iv) POP
Sketch the final structure of stack after performing the above said operation
Summer
14 Evaluate the following postfix expression: 4 6 24 + * 6 3 / - 6
23
Winter-
15 List any four applications of stack 2
22
1. Reversing a string
2. Polish notation
3. Conversion of infix to postfix
4. Recursion
5. Backtracking
6. Evaluation of postfix expression
Convert following expression into postfix form with illustration of all steps using stack Winter-
16 4
:(A + B – C + D*E/F^G) 22
Winter-
22,
17 Differentiate between Stack and Queue (any four points). 4
Winter
18
Winter-
22,
18 Explain stack overflow and stack underflow with example. 4
Summer
19
Write a menu driven ‘C’ program to implement stack using array with the following Winter-
19 6
menu: i) push ii) pop iii) display iv) exit 22
Summer
22 Write a program to implement a stack with push, pop and display operations. 6
22
Evaluate the following postfix expression: 10, 2, *, 15, 3, /, +, 12, 3, +, + Show Summer
21 4
diagrammatically each step of evaluation using stack. 22
Convert the following Infix expression to its prefix form using stack. Show the details Summer
23 6
of stack at each step of conversion. Expression: P * Q R – S / T + (U/V) 22
Winter-
24 Define the terms ‘overflow’ and ‘underflow’ with respect to stack. 2
19
Convert the following infix expression to postfix expression using stack and show the Winter-
26 4
details of stack in each step. ((A+B)*D)^(E-F) ((A+B)*D)^(E-F) 19
Show the effect of PUSH and POP operations on the stack of size 10. PUSH(10) , Winter-
27 4
PUSH(20), POP, PUSH(30) 19
Winter -
28 Explain the concept of recursion using stack. 6
19
Summer-
29 Show the memory representation of stack using array with the help of a diagram. 2
19
Convert the following infix expression to its prefix form using stack A + B – C * D / Summer-
30 2
E+F 19
Show the effect of PUSH and POP operation on to the stack of size 10. The stack
Summer-
33 contains 40, 30, 52, 86, 39, 45, 50 with 50 being at top of the stack. Show 6
19
diagrammatically the effect of :
(i)PUSH 59 (ii) PUSH 85 (iii) POP (iv) POP (v) PUSH 59 (vi) POP .Sketch the final
structure of stack after performing the above said operations.
Summer-
34 Evaluate the following postfix expression: 57 + 62 – * 6
19
Convert following expression into postfix form. Give stepwise procedure. A + B ↑ C * Winter
37 4
(D / E) – F / G 18
Winter
38 Write algorithm for performing push and pop operations on stack. 6
18
Define the term recursion. Write a program in C to display factorial of an entered Winter
39 6
number using recursion. 18
QUESTION BANK
CO.5: Perform operation on Queue using Array and Linked List Implementation
Sr.
Questions Year Marks
No.
Summer 24,
Implement a ‘C ’ program to insert element into the queue and delete the Winter 23,
1 Winter 22,
4
element from the queue
Winter 19
Summer 24,
2 With a neat sketch explain working of priority queue winter 22
6
Winter 23,
3 List any four applications of queue Winter 22, 2
Winter 18
4 Draw the diagram of Linear Queue to represent front and rear pointers. Summer 23 2
Show the effect of INSERT and DELETE operation onto the linear queue of
size 10. The linear queue sequentially contains 10,20,30,40, and 50 where 10 is
front of the queue. Show diagrammatically the effect of –
I. INSERT(75)
5 II. INSERT(85) Summer 23 6
III. DELETE
IV. INSERT(60)
V. DELETE
VI. INSERT(90)
7 Draw the diagram of circular queue with front and rear pointers. Summer 22 2
9 Define queue. State any two applications where queue is used. Winter-19 2
10 Explain the concept of circular Queue along with its need. Winter-19 4
1. Queue Full
2. Queue Empty
Describe queue full and queue empty operation conditions on linear queue with
13 Winter 18 4
suitable diagrams.
QUESTION BANK
UNIT 6: Tree Marks:16
CO.6: Create and traverse Tree to solve problem
No.
6 Define the term tree traversal. Construct the Binary Search Tree (BST) of Winter 23 6
following: 85, 90, 45, 60, 25, 35, 10, 20, 75, 95 and traverse the above BST in
inorder, preorder & postorder.
8 Differentiate between tree and graph with respect to any four parameters Summer 23, 4
Winter 19
10 Summer 23 6
11 Winter- 22 2
Write algorithm for preorder traversal of binary tree.
13 Winter- 22 4
Draw tree for given expression : (a-2b+5c)2 * (4d-6e)
General tree: is a tree where each node may have zero or more children.
Binary tree: is a tree where every node can have maximum of two children is called
as binary tree.
22, 27,14,31,40,43,44,10,20,35
16 Draw tree for given expression and find pre-order and post-order traversal. Summer 22 6
17 Draw a binary search tree for the given numbers : 50, 33, 44, 22, 77, 35, 60, 40. Winter 19 4
18 Draw an expression tree for the following expression : (a – 2b + 5c)2 * (4d = 6e)5 Winter 19 4
21 Traverse the following tree by the in-order, pre-order and post-order methods : Summer-19 6
22 Describe following terms w.r.to tree : (i) leaf node (ii) level of node Winter 18 2
23 Differentiate between general tree and binary tree. (any four points) Winter 18 4
30, 100, 90, 15, 2, 25, 36, 72, 78, 10 show each step of construction of BST.
25 For given binary tree write in-order, pre-order and post-order traversal. Winter 18 6
“MASTER SOLUTIONs”
Marks
1. Attempt any FIVE of the following : 10
(a) Define the term algorithm.
(b) List any 4 applications of queue.
(c) Describe following terms w.r.to tree :
(i) leaf node
(ii) level of node
(d) Differentiate between stack and queue. (any two points)
(e) Describe undirected graph with suitable example.
(f) Define the terms : linear data structure and non-linear data structure.
(g) Convert infix expression into prefix expression : (A + B)*(C / G) + F
[1 of 4] P.T.O.
22317 [2 of 4]
3. Attempt any THREE of the following : 12
(b) Convert following expression into postfix form. Give stepwise procedure.
A + B ↑ C * (D / E) – F / G
(c) Find the position of element 29 using binary search method in an array ‘A’
given below. Show each step.
(d) Give adjacency list and adjacency matrix for given graph :
30, 100, 90, 15, 2, 25, 36, 72, 78, 10 show each step of construction of BST.
(e) Describe circular linked list with suitable diagram. Also state advantage of
circular linked list over linear linked list.
22317 [3 of 4]
5. Attempt any TWO of following : 12
(a) Write algorithm for performing push and pop operations on stack.
(b) For given binary tree write in-order, pre-order and post-order traversal.
(c) Write an algorithm to insert an element at the beginning and at end of linked
list.
(a) Describe working of selection sort method. Also sort given input list in
ascending order using selection sort input list – 55, 25, 5, 15, 35.
(c) Describe procedure to delete an element from singly linked list using diagram.
_______________
P.T.O.
22317 [4 of 4]
21819
22317
3 Hours / 70 Marks Seat No.
Marks
(c) Define :
(d) Show the memory representation of stack using array with the help of a
diagram.
(f) Differentiate between linear and non-linear data structures on any two
parameters.
(g) Convert the following infix expression to its prefix form using stack
A+B–CD/E+F
[1 of 4] P.T.O.
22317 [2 of 4]
2. Attempt any THREE of the following : 12
(c) Sort the following numbers in ascending order using quick sort. Given
numbers 50, 2, 6, 22, 3, 39, 49, 25, 18, 5.
(iii) Path of 31
P.T.O.
22317 [4 of 4]
6. Attempt any TWO of the following : 12
(a) Sort the following numbers in ascending order using Bubble sort. Given
numbers : 29, 35, 3, 8, 11, 15, 56, 12, 1, 4, 85, 5 & write the output after each
interaction.
57 + 62 –
(c) Create a singly linked list using data fields 90, 25, 46, 39, 56. Search a node
40 from the SLL and show procedure step-by-step with the help of diagram
from start to end.
_______________
11920
22317
3 Hours / 70 Marks Seat No.
Marks
(a) Write any four operations that can be performed on data structure.
(b) Define the terms ‘overflow’ and ‘underflow’ with respect to stack.
(c) Define the following terms w.r.t. tree : (i) In-degree, (2) Out-degree
P : 4, 2, ^, 3, *, 3, -, 8, 4, /, +
(g) Define queue. State any two applications where queue is used.
(a) Sort the given numbers in ascending order using Radix sort :
[1 of 4] P.T.O.
22317 [2 of 4]
(b) Write an algorithm to insert a new node at the beginning and end of the singly
linked list.
(c) Explain the concept of circular Queue along with its need.
(d) Draw a binary search tree for the given numbers :
50, 33, 44, 22, 77, 35, 60, 40.
P.T.O.
22317 [4 of 4]
12223
22317
3 Hours / 70 Marks Seat No.
Marks
(i) searching
(ii) sorting
(c) List any four applications of stack.
(d) List any four types of queue.
(e) Define Abstract data type.
(f) Define the following terms :
(i) Sibling
(ii) Depth of tree
(g) Write algorithm for preorder traversal of binary tree.
[1 of 4] P.T.O.
22317 [2 of 4]
2. Attempt any THREE of the following : 12
(a) Write a program to implement bubble sort.
(b) Convert following expression into postfix form with illustration of all steps
using stack :
(A + B – C + D*E/F^G)
(c) Differentiate between Stack and Queue (any four points).
(d) Explain node structure for single linked list. Also write advantages of singly
list over array. (any Two)
P.T.O.
22317 [4 of 4]
21222
22317
3 Hours / 70 Marks Seat No.
15 minutes extra for each hour
Marks
1. Attempt any FIVE of the following : 10
(a) Define linear data structure and non-linear data structure.
(b) Enlist operations on stack.
(c) Define : (i) General tree (ii) Binary tree
(d) Draw the diagram of circular queue with front and rear pointers.
(e) Describe given two types of graphs : Directed and Undirected graph.
(f) Define Abstract Data Type.
(g) State any four applications of queue.
[1 of 4] P.T.O.
22317 [2 of 4]
3. Attempt any THREE of the following : 12
(c) Find the position of element 30 using Binary search method in array
(c) Write an algorithm to insert a new node at the beginning of a Singly linked
list. Give example.
(d) Write a ‘C’ program to calculate the factorial of number using recursion.
(e) Describe circular linked list with suitable diagram. Also state advantage of
circular linked list over linear linked list.
22317 [3 of 4]
5. Attempt any TWO of the following : 12
(a) Write a program to implement a stack with push, pop and display operations.
(b) Draw tree for given expression and find pre-order and post-order traversal.
(a) Describe the working of Selection Sort Method. Also sort given input list in
ascending order using selection sort.
(b) Convert the following Infix expression to its prefix form using stack. Show
the details of stack at each step of conversion.
Expression : P * Q R – S / T + (U/V)
(c) Create a Singly linked list using data fields 70, 50, 30, 40, 90. Search a node
40 from the singly linked list & show procedure step-by-step with the help of
diagram from start to end.
_______________
P.T.O.
22317 [4 of 4]
21819
22317
3 Hours / 70 Marks Seat No.
Marks
a) State any two differences between linear search and binary search
c) Define the terms: Linear data structure and non-linear data structure
f) Convert the following infix expression to its postfix form using stack: A + B – C *
D/E+F
g) Describe given two types of graphs: Directed graph and Undirected graph
a) Create singly linked list using data fields 10, 20, 30, 40, 50 and show step by step
procedure with the help of diagram from start to end.
b) Describe advantages of circular link list over linear link list with example
a) Define the term tree traversal. Construct the Binary Search Tree (BST) of following:
85, 90, 45, 60, 25, 35, 10, 20, 75, 95 and traverse the above BST in inorder, preorder
& postorder.
c) Implement a 'C' program to insert element into the queue and delete the element
from the queue.
6. Attempt any TWO of the following: 12
I. [(A+B)+C]*D
II. A[(B * C) + D]
b) Sort the following number in ascending order using bubble sort. Given numbers as
follows : 475, 15, 513, 6753, 45, 118.
c) Describe circular linked list with suitable diagram. State advantages of circular
linked list over linear linked list.
1
2
3
4
1
2
3
4
Jaywant Shikshan Prasarak Mandal’s
RAJARSHI SHAHU COLLEGE OF ENGINEERING’s
POLYTECHNIC
S.No.80, Pune-Mumbai Bypass Highway, Tathawade Campus, Pune.