1.

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 II had been asked this question in class test.

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.



Discussion

No Comment Found

Related InterviewSolutions