B.
TECH - CS
Assignment - 2
Semester-I (Odd), Session: 2023-24
BCS-301: Data Structure
Unit-2 Course Outcome: CO2 – Describe how arrays,
Unit-Name: Stacks and Queues stacks and Queues are represented in memory,
used by the algorithms and their common
applications
Date of Distribution: 11/10/2023 Faculty Name: Dr. Ashish Avasthi, Dr. Arpita
Singh and Mr. Abhishek Tiwari
Sr. MANDATORY QUESTIONS BL
1 Write difference between array and linked list. 2
2 Discuss PUSH and POP operation in stack and write down their algorithm 2
3 Write a C function for array implementation of stack. Write all primitive operations. 3
4 Write a C function for linked list implementation of stack. Write all the primitive 3
operations.
5 What is stack ? Implement stack with singly linked list. 1
6 Write a function in C language to reverse a string using stack. 3
7 Write a short note on the application of stack. 2
8 Write down the algorithm to convert infix notation into postfix 2
9 Convert following infix expression into postfix expression A + (B * C + D)/E. 5
10 Consider the following infix expression and convert into reverse polish notation 5
using stack. A + (B * C – (D/E ^ F) * H)
11 Write down the algorithm to evaluate the postfix expression 3
12 Consider the following arithmetic expression written in infix notation : 5
E = (A + B) * C + D / (B + A * C) + D
E = A/B C+D*E–A*C
Convert the above expression into postfix and prefix notation.
13 Write the procedures for insertion, deletion and traversal of a queue. 2
14 What is circular queue ? Write a C code to insert an element in circular queue. Write 3
all the condition for overflow.
15 Explain how a circular queue can be implemented using arrays. Write all functions 3
for circular queue operations.
16 What do you mean by priority queue ? Describe its applications. 1
SUPPLEMENTARY QUESTIONS
1 Evaluate the result for postfix expression 10 5+60 6/ 8−.
2 The following postfix expression with single digit operands is evaluated using a stack:
8 2 3 ^ / 2 3 * + 5 1 * - Note that ^ is the exponentiation operator. The top two elements
of the stack after the first * is evaluated are:?
IQAC/ASU/F/2023-24/2.1 Page 1 of
2
3 The following sequence of operations is performed on stack: PUSH (10),PUSH 5
(20),POP,PUSH (10),PUSH (20),POP,POP,POP,PUSH (20),POP The sequence of
the value popped out is:
REFERENCES
TEXT BOOKS:
Ref. Authors Book Title Publisher/Press Edition &Year of
[ID] Publication
Data Structure Using C Oxford Higher 6th 2020
[T1] Thareja
Education
“Data Structures” McGraw-hill 7th edition
[T3] Lipschutz
Education (India)
[T2] . AK Sharma Data Structure Using C Pearson Education 5th 2018
India
ONLI NE/DIGITALREFERENC ES:
Ref.
Source Name Source Hyperlink
[ID]
Great Learning
[D1] https://www.mygreatlearning.com/blog/data-structures-using-c/
IQAC/ASU/F/2023-24/2.1 Page 2 of 2
Signature of Faculty:______________ Signature of HOD:_______________
(With Date) (With Date)