+1 vote
in Data Structures & Algorithms I by (110k points)
What is the time complexity of reversing a word using stack algorithm?

(a) O (N log N)

(b) O (N^2)

(c) O (N)

(d) O (M log N)

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

I had been asked this question in class test.

1 Answer

+1 vote
by (408k points)
selected by
Best answer
Correct choice is (c) O (N)

For explanation: The time complexity of reversing a stack is mathematically found to be O (N) where N is the input.

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.