Can you please elaborate on this? I think what you said is the neccessary condition for palindroms but not the sufficient. What I mean is with these checks, you can rule out the non-palindrom strings quickly but to make sure that a particular string is palindrom, you will need to have some more checks.
On Sun, Jul 24, 2011 at 8:11 PM, sasi kumar <tmsasiku...@gmail.com> wrote: > On 24 July 2011 20:04, vaibhav shukla <vaibhav200...@gmail.com> wrote: > > generate all possible permutations and check each permutation whether it > is > > palindrome or not. > > > The time complexity will be high. Instead find the length of the > string . If it is even check the number of occurences > of every character . If a character occurs for an odd number of time > then it will not be a palindrome. Check for even number of > occurences of every character. If the length of the string is odd . > One character must occur odd number of time . > > So the problem can be solved just by counting > > Regards > Sasi kumar T > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Dinesh Bansal The Law of Win says, "Let's not do it your way or my way; let's do it the best way." -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.