A palindrome is a word, phrase, number or other sequence of units that has the property of reading the same in either direction. Example level, ABA See more at: http://en.wikipedia.org/wiki/Palindrome
The C++ language is really good to implement this kind of algorithm * really fast * generic * good abstration
And how about your language? :) ```cpp
using namespace std;
template
template
return PalindromeCheckAlgorithm(container.begin(), container.end() - 1);
}
inline bool PalindromeCheck(const wchart * pszText) { const sizet lenght = wcslen(pszText);
if (lenght == 0)
return false;
return PalindromeCheckAlgorithm(pszText, pszText + lenght - 1);
}
void assert2(bool b) { if (!b) cout << "error!"; }
int main()
{
vector
Stopwatch stopwatch(true);
for (int i = 0; i < 10000000; i++)
{
assert2(PalindromeCheck(L"") == false);
assert2(PalindromeCheck(L"1") == true);
assert2(PalindromeCheck(L"A") == true);
assert2(PalindromeCheck(L"ABC") == false);
assert2(PalindromeCheck(L"ABC") == false);
assert2(PalindromeCheck(L"level") == true);
assert2(PalindromeCheck(L"level") == true);
assert2(PalindromeCheck(L"ABBA") == true);
assert2(PalindromeCheck(L"1221") == true);
assert2(PalindromeCheck(numbers) == true);
}
stopwatch.Stop();
cout << "elapsed time: " << stopwatch << endl;
int i;
cin >> i;
}
See also: [Stopwatch.htm](Stopwatch)