DST Unit 5 – Stack and Queue most asked questions
Topic : Stack (Key Note and Questions)
Key Note:
- Stack is a linear data structure that follows LIFO principles.
- LIFO stands for Last In First Out
- We can implement stack using linked list and array.
- Some Application of Data Structure are Infix to Postfix conversion, Infix to Prefix conversion, Postfix and prefix evaluation etc.
Questions
- Q1). What is stack? Explain with suitable example with all its application.
- Q2). Implement stack with singly linked list.
- Q3). What is push and pop operation of stack? Write the alorithm for push and pop operation.
- Q4). Write a program in c for array implementaion of stack.
- Q5). Write a program in c for linked list implementaion of stack.
- Q6). What is infix, prefix and postfix expression? Explain with example.
- Q7). Write down an algorithm to evaluate the infix expression.
- Q8). Write down an algorithm to evaluate the postfix expression.
- Q9). Write down an algorithm to evaluate the Prefix expression.
- Q10). Convert following infix expression into postfix expression A+(B*C+D)/E
-
Q11). Write an algorithm to convert a postfix expression into an infix expression. Consider the following arithmetic expression in postfix notation: 752+*415-/-
a). Find the value of the expression.
b). Find the equivalent prefix form of the above expression. -
Q12). Solve the following:
a). ((A-(B+C)*D)/(E+F))[Infix to postfix]
b). (A+B)+*C-(D-E)^F[Infix to prefix]
c). 752+*415-/-[Evaluate the given postfix expression] - Q13). The efficient method used in evaluating a polynomial of the form.
- Q14). What is recursion? Write its principle. Explain with the help of example.
- Q15). Explain the types of recursion.
- Q16). Explain the procedure to convert a recursive algorithm to a non-recursive algorithm.
- Q17). Explain Tower of Hanoi with example.
- Q18). Write the recursive algorithm for solving the problem of Tower of Hanoi and also explain its complexity. Illustrate the solution for four disks and three pegs.
Topic : Queue (Key Note and Questions)
Key Note:
- Queue is a linear data structure that follows FIFO principles.
- FIFO stands for First In First Out.
- Queue can be implemented using Array and Linked List.
- Application of Queue is, Queue is helpful in CPU scheduling, Disk Scheduling, Handling of interrupts in real-time systems etc
Questions
- Q1). Write a note on queue. Explain its various operations.
- Q2). Write various algorithms for all operations of queue like insertion, deletion and traversal .
- Q3). What is circular queue? Write a C code to insert an element in circular queue. Write all the condition for overflow.
- Q4). Write a C program to implement the array representation of circular queue.
- Q5). Write a program or function in C to find out duplicate element in the queue.
- Q6). Explain queue and priority queue. Also write its types.
Latest Uploads on Website
- AVL Tree with explanation
- Radix sort algorithm explanation with example
- Quick Sort Algorithm with explanation
- Bubble sorting algorithm with Bubble sort program in C
- Insertion sort algorithm and program in C
- Selection Sort Algorithm and Program in C
- Linear probing technique explanation with example
- Collision in Hashing and Collision resolution technique
- Hashing in data structure with its types
- Binary search tree operations with Program
- Binary search tree in data structure
- Binary search algorithm in data structure with explanation
- linear search in data structure with Algo and Program