+1 vote
in Data Structures & Algorithms I by (110k points)
What will be the word obtained if the word “abbcabb” is reversed using a stack?

(a) bbabbca

(b) abbcabb

(c) bbacbba

(d) bbacabb

I want to ask this question from Reverse a Word using Stack topic in chapter Application of Stacks of Data Structures & Algorithms I

This question was posed to me during an online exam.

1 Answer

+1 vote
by (408k points)
selected by
Best answer
Correct answer is (c) bbacbba

Easiest explanation - The string “abbcabb” is pushed on to the stack. If the characters are popped one by one, the word obtained will be bbacbba.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.