Project Assignment 3

CSC255 - Information Structures & Representations

Due: 6/12/2001

A palindrome is a word that is spelled the same forward and backward. For example, the word "radar" is a palindrome.

Develop an algorithm that will be able to examine a string of letters terminated by a period and will determine whether or not the word (without the period) is a palindrome. If necessary, you may assume that the word contains lowercase letters only. Note that your algorithm need not check that the words are actually English words. That is, the word "aabbcbbaa" is considered a palindrome.

Submit your algorithm along with a trace of your algorithm using the word "radar" as input. Your algorithm must be sufficiently general to handle words of different lengths.

Note: Words should be represented by an array called wordarray of size 100 cells. This means that your algorithm will be able to examine words of at most 99 characters in length.

Each character in the word will be in a cell of the array, with the first character in the first cell. For example, the word "radar" would be represented thus:

   wordarray[1] = r
   wordarray[2] = a
   wordarray[3] = d
   wordarray[4] = a
   wordarray[5] = r
   wordarray[6] = .