This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes is thie the algorithm for cheking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

is thie the algorithm for cheking

nitin ratra
Greenhorn

Joined: Aug 11, 2008
Posts: 25
step1. mid_index = (total_length - 1)/2 (for odd) or (total_length/2)-1 for even

step2. max_index = total_length - 1 (to pick up letters from end)

step2. loop_index = 0

step3. pick letter at loop_index, pick letter at max_index - loop_index

step4. compare them, if not equal, print "not palindrome" and exit.

step5. loop_index = loop_index + 1

step6. if loop_index > mid_index goto step7 else goto step3

step7. end of loop, and no mismatch found. Hence print "palindrome" and exit.



This is the algorithm for checking if NITIN is a aplindrome or not is it ryt friends
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

This is the algorithm for checking if NITIN is a aplindrome or not is it ryt friends

Why dont you check it out yourself

And while posting use UseRealWords."ryt" is no a real word.


SCJP, SCWCD.
|Asking Good Questions|
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

And do not ask the same question more than once, it wastes useful time of others and also reduces the the number of replies you get.
Read this for more information.
someone among the moderators will close this thread.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18550
    
  40

Yes, let's continue this in the orignal thread...

http://www.coderanch.com/t/411445/java/java/check-whether-word-palindrome

I will close this one.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is thie the algorithm for cheking
 
Similar Threads
palindrome not very proficient...
Palindrome
Palindrome
Palindrome no. problem
how to check whether a word is a palindrome