Single Pass Palindrome Determination

We are supposed to give an algorithm which would determine whether the given input string is a palindrome or not. However there are certain constraints on the algorithm. The constraints are as follows -
  • You do not know the length of the input string
  • You can read each character of the input string only once (I think that the implication of this constraint along with the previous should be clear to everyone)
  • You have to employ constant space
Now you have to come up with an algorithm and if you claim it to be the best then a proof for the same.

0 Comments: