DS - Unit-1 Previous Questions

Syllabus

Introduction to Data Structures: Definition, Need of Data Structures, Classification of Data Structures.

Recursion: Recursive definition and processes, Designing the recursive functions, Examples on recursion: Factorial of a number, Fibonacci numbers, Towers of Hanoi problem for ‘n’ disks.

Stack: Introduction to Stacks, Operations on a Stack and Applications of Stacks: Conversion from Infix to Postfix, evaluation of a postfix expression.


SEMESTER END EXAMINATIONS – JUNE 2024

Justify the usage of stacks for reversal of strings while explaining the various operations related to stack data structure.

Write an algorithm to convert an infix expression to postfix. Use the algorithm for converting the following expression into postfix form. (a+b)*(c+(d-e))

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


Write a recursive function to solve Towers of Hanoi problem for ‘n’ disks and interpret the recursive calls for the transfer of three disks.

Write a function in C for evaluating a postfix expression. Justify the usage of stack for evaluating the given expression: PQ+R-QP+R^- where P=1, Q=2, R=3.


BACKLOG SUBJECT EXAMINATIONS – SEPTEMBER / OCTOBER 2023

Write a C program to convert an infix expression to postfix expression using STACK. Also convert the following infix expression to postfix expression by mentioning the steps clearly: (((A/B)+C*(D-E)^F)*G).

Write a C program to Reverse a String using STACK data structure.

Write a recursive C program to find GCD of two numbers.


Write C functions to perform push (), pop () and display operations on STACK.

Design an algorithm to evaluate a postfix Expression. And Trace the algorithm for the expression: 6 2 3 + - 3 8 2 / + * 2 $ 3 +.

Write a Recursive C program to solve tower of Hanoi problem. Find the number of moves required to solve the same problem for 5 Disks.


SEMESTER END EXAMINATIONS – MAY / JUNE 2023

What are Data Structures? Explain the classification of data sutures with examples?

Write an algorithm to evaluate a postfix expression and apply the same for the given expression. AB/CDE$*-F+ Assume A=12, B=3, C=2, D=5, E=1, F=7

Differentiate between iterative functions and recursive functions.


Define stack. Give the implementation of push, pop and display functions. Include check for empty and full conditions.

Convert the following infix expression to postfix and prefix expressions: i) (A ^ B * (H - J * K)) + P / K * G ii) 3 – 6 / (9 * (2 ^ 4))

Define Recursion. Write a recursive c function for the following: i) Find factorial of a number ii) Solve Towers of Hanoi problem.


SUPPLEMENTARY SEMESTER EXAMINATIONS - NOVEMBER 2022

Define data structure. List its types and also explain the need of Data structures.

Convert the following infix expression to postfix expression by showing the steps clearly: i. ((A+(B-C) *D) ^E+F) ii. X^Y^Z-D+E+F/G

What is Recursive function? Write a recursive program to find Factorial of a number.


What is Stack? Write C functions to perform push (), pop () and display operations on STACK.

Design an algorithm to evaluate a postfix Expression. And Trace the algorithm for the expression: XYZ + * ZYX - + * where X=1, Y=2, Z=3.

State tower of Hanoi problem. Write a recursive C function to solve the same problem for three disks.


SEMESTER END EXAMINATIONS – JUNE 2022

Write the difference between iterative method and recursion method. Is it advisable to generate Fibonacci Series using recursion? Justify your answer with an example.

Develop an algorithm to evaluate a postfix expression. Trace the algorithm for the expression: 2536+**5/2-


Define Stack. Develop routines to handle insert, push, pop and print operations on Stack.

Write the algorithm for converting the Infix Expression to Postfix expression. Also transform the following expression to its postfix equivalent form by using the conversion algorithm steps. ((A+B)^C-(D*E)/F)


EXAMINATIONS SEPTEMBER /OCTOBER 2021

Define data structure. List its types and also explain the need of Data structures.

Convert the following infix expression to postfix expression by showing the steps clearly: i. ((M+(N-O)*P)^Q+R) ii. A^B^C-D+E+F/G

What is Recursive function? Write a recursive program to find Fibonacci series.


What is Stack? Write a c program to implement stack using an array checking all necessary conditions and to perform the following operations: push (), pop () and display.

Design an algorithm to evaluate a postfix Expression.

State tower of Hanoi problem. Write a recursive C function to solve the same problem for three disks.


SEMESTER END EXAMINATIONS – JULY / AUGUST 2021

Define Stack. Develop routines to handle push, pop and print operations on Stack.

Develop an algorithm to evaluate a postfix expression. Trace the algorithm for the expression: ABC + * CBA - + * where A=1, B=2, C=3.


Explain how stacks can be used in recursion. Write the recursive algorithm to solve towers of Hanoi problem. Trace the algorithm considering 3 disks.

Write the algorithm for converting the Infix Expression to Postfix expression. Also transform the following expression to its postfix equivalent form by using the conversion algorithm steps. ((A+B)^C-(D*E)/F)