Data Structure Questions and Answers-Reverse a Word using Stack
Click on any option to know the CORRECT ANSWERS
Reversing a word using stack can be used to find if the given word is a palindrome or not.
Question 1 Explanation:
This application of stack can also be used to find if the given word is a palindrome because, if the reversed is same as that of the original word, the given word is a palindrome.
Which is the most appropriate data structure for reversing a word?
Question 2 Explanation:
Stack is the most appropriate data structure for reversing a word because stack follows LIFO principle.
Operations required for reversing a word or a string using stack are push() and pop().
Question 3 Explanation:
Push operation inserts a character into the stack and pop operation pops the top of the stack.
What is the time complexity of reversing a word using stack algorithm?
O (N log N)
O (M log N)
Question 4 Explanation:
The time complexity of reversing a stack is mathematically found to be O (N) where N is the input.
What will be the word obtained if the word "abbcabb" is reversed using a stack?
Question 5 Explanation:
The string "abbcabb" is pushed on to the stack. If the characters are popped one by one, the word obtained will be bbacbba.
There are 5 questions to complete.