Write a program to reverse a string?
Algorithm 1 using stack :
1) Create an empty stack. 2) One by one push all characters of string to stack. 3) One by one pop all characters from stack and put them back to string.
Algorithm 2 using array:
1. here we have to swap the elements
Comments
Post a Comment