You are on page 1of 2

JK Lakshmipat University, Jaipur

Data Structures -CS1102


Assignment#3
Issue Date: 16.09.2022 Due date: 14.10.2022
***************************************************************
Q. 1. Convert the given infix expression into postfix expression, write the
algorithm also.
Q. 2. Write an algorithm for the evaluation of arithmetic expressions. Also,
write an algorithm to convert from infix to prefix OR from infix to
postfix.
Q. 3. What is recursion? Write a function and explain the working of the
Tower of Hanoi. Illustrate how recursion can be implemented by using a
tower of Hanoi problem for 4 disks.
Q. 4. Differentiate between TAIL Recursion and Non-TAIL recursion with
the help of a suitable example.
Q. 5. What is recursion? Illustrate how recursion can be implemented by using
a tower of Hanoi problem for 4 disks.
Q. 6. Write an algorithm for infix to postfix expression conversion. Carefully
state any assumptions you make regarding the inputs.
Q. 7. Explain the Insertion and Deletion operation of Stacks using the linked
list. Give the proper examples.
Q. 8. Describe how you could use a single array to implement three stacks.
Q. 9. How would you design a stack which, besides, to push and pop, also
has a function max which returns the maximum element? Push, pop and
max should all operate in constant time.
Q. 10. In the classic problem of the Towers of Hanoi, you have 3 rods and N
disks of different sizes which can slide onto any tower. The puzzle
starts with disks sorted in ascending order of size from top to bottom
(e.g., each disk sits on top of an even larger one). You have the
following constraints:

(A) Only one disk can be moved at a time.

(B) A disk is slid off the top of one rod onto the next rod.

(C) A disk can only be placed on top of a larger disk.

Write a program to move the disks from the first rod to the last using
Stacks.

Q. 11. You have a row of binary digits arranged randomly. Arrange them in
such an order that all 0’s precede all 1’s or vice versa. The only
constraint in arranging them is that you are allowed to interchange the
positions of binary digits if they are not similar. Write a program in C
using the pointer to solve the problem.
E.g.: 11010100  00001111 OR 11110000

You might also like