# 18CS32 Data Structures and Applications Question Bank – 2

[wptelegram-join-channel]

### MODULE – 2: STACKS AND QUEUES

1. Define stack. Implement the operations of stack using arrays.

2. How stacks are represented using arrays?

3. Explain stacks operations using dynamic arrays

4. What is expression? Write the different ways of representing expressions

5. Assume A=1, B=2, C=3. Evaluate the following postfix expressions:

a. A B + C – B A + C \$ –

b. A B C + * C B A – + *

6. Apply suitable data structure to covert infix to postifix expression

a. A \$ B * C – D + E / F / (G + H)

b. A – B / (C * D \$ E)

c. ((A-(B+C))*D)\$(E+F)

d. (a * b) +c/d

e. (((a / b)-c) + (d * e)) – (a * c).

7. State the advantages of using infix & postfix notations

8. Write a C function to convert infix to a postfix expression

9. Write a C function to evaluate a postfix expression.

10. Convert the infix expression a/b – c+ d * e – a * c into postfix expression. Write a function to evaluate that postfix expression and trace that for given data a=6, b=3, c = 1, d = 2, e =4.

11. What is a recursive function? Show how factorial using for loop is different from a recursive function

12. With an example explain the GCD and Fibonacci sequence.

13. Discuss the Tower of Hanoi with an example using a recursive function.

14. Write a note on the Ackermann function

15. Define Queue. Implement the operations of the queue using arrays. Apply the same on job scheduling.

16. Show how queues are represented using arrays?

17. Explain queues operations using dynamic arrays.

19. Give the disadvantage of the ordinary queue and how it is solved in a circular queue. Explain with a suitable example of how you would implement a circular queue using a dynamically allocated array.

20. What is a circular queue? Explain how it is different from the linear queue. Write a C program for primitive operations of the circular queue.

21. What is the problem encountered with the circular queue? Explain how the dynamic the circular queue can solve the problem with an example.

22. Write a note on the dequeue.

23.Define priority queue. Explain in detail the representation of a Priority Queue with an example.

24.Explain multiple stacks and queues.

25.Briefly explain the mazing problem with an initial maze algorithm.