Operational vs. Denotational in Java

An operational program for palindrome testing:

boolean function palindrome(String x) {
	int half = x.length() div 2;
	if (half != 0) 
		for(i=0; i++, i <=  half) 
			if  (x.charAt(i) != x.charAt(x.length() - 1 - i)  return (true);
}

A denotational program (assuming match and reverse are defined):

boolean match(String x, String y);

String reverse(String x);

boolean function palindrome(String x) { return(match(x, reverse(x))}
        


Last Updated: August 18, 2005