1.

A word, say “computer” is stored in an array. Another array is to be created by storing the reverse of the word. How can stack support you to perform this task? Explain the algorithm.

Answer»

This can be performed by pushing each character of the word “computer” onto a stack as it is read. After the word is finished, then the characters are popped o the stack, so they will come in the reverse order such as “retupmoc” in the desired output.



Discussion

No Comment Found