Palindromes
In this post I will try to optimize and make parallel (if necessary) an algorithm which determines whether a given English word is a palindrome or not. The input was of 71 million words. You may have a look at the initial program here Program description It consists of three functions along with the main function : findPalindromes - takes the input size and words, outputs the no. of palindromes. parse_string - converts a given input string into lower case. is_palindrome - checks if the given input word is a palindrome. When i ran the algorithm with the input, I got the following output gprof parallel_palin.exe | more gave the following output The above image shows that the program is spending most of it's time in the function parse_string. I removed the use of function parse_string in the function findPalindromes and ran the program again. There was a huge decrease in the execution time, though the answer was not correct, but ...