Unit 3: Stacks and Queues - Subjective Questions

CSE205 — Data Structures And Algorithms • Practice Questions with Detailed Answers

20 questions

1

Define a stack. Explain its fundamental principle and give two real-world applications.

2

Describe the array representation of a stack. Explain how overflow and underflow conditions are detected.

3

Explain the linked-list representation of a stack with suitable insertion and deletion steps.

4

Compare the array representation and linked-list representation of a stack.

5

Write and explain an algorithm for the PUSH operation on an array-based stack. Analyze its time complexity.

6

Write and explain an algorithm for the POP operation on an array-based stack. What happens when the stack is empty?

7

Explain how an array-based stack is traversed. Write an algorithm to display all stack elements without changing the stack.

8

Explain infix, prefix, and postfix notation. Convert the infix expression into prefix and postfix forms.

9

Describe a stack-based algorithm for transforming an infix expression into postfix notation. Convert into postfix form.

10

Explain how a postfix expression is evaluated using a stack. Evaluate 5 6 2 + * 12 4 / -.

11

Describe how a prefix expression is evaluated using a stack. Evaluate - * 8 3 / 20 5.

12

Define a queue and explain its array representation using FRONT and REAR variables.

13

Explain the linked-list representation of a queue and state the roles of the FRONT and REAR pointers.

14

Write an algorithm for inserting an element into a linear array queue. Explain the overflow condition.

15

Write an algorithm for deleting an element from a linear array queue. Explain how the last-element case is handled.

16

Explain queue traversal for both array and linked-list representations. State the time complexity.

17

Compare a linear queue and a circular queue. Derive the conditions for insertion and deletion in a circular array queue.

18

Define a priority queue. Explain its types, basic operations, and two implementation methods.

19

What is a deque? Distinguish between an input-restricted deque and an output-restricted deque.

20

Design the insertion and deletion operations for an array-based circular deque. Include the full and empty conditions.