Stack Reversal using Recursion Multiple choice Questions and Answers (MCQs)
Click on any option to know the CORRECT ANSWERS
Which of the following statement is true about stack?
Pop operation removes the top most element
Pop operation removes the bottom most element
Push operation adds new element at the bottom
Push operation removes the top most element
Question 1 Explanation:
As stack is based on LIFO(Last In First Out) principle so the deletion takes place from the topmost element. Thus pop operator removes topmost element.
What is the space complexity of program to reverse stack recursively?
O(n log n)
Question 2 Explanation:
The recursive program to reverse stack uses memory of the order n to store function call stack.
Stack can be reversed without using extra space by .....
using linked list to implement stack
using an extra stack
it is not possible
Question 3 Explanation:
If linked list is used for implementing stack then it can be reversed without using any extra space.
Which of the following is considered as the top of the stack in the linked list implementation of the stack?
Question 4 Explanation:
First node is considered as the top element when stack is implemented using linked list.
What is the time complexity of the program to reverse stack when linked list is used for its implementation?
O(n log n)
Question 5 Explanation:
As a linked list takes O(n) time for getting reversed thus linked list version of stack will also take the same time.
There are 5 questions to complete.