answersLogoWhite

0


Best Answer

Let L = length of the string.

greatest integer (L/2) gives the number of pairs of characters that must be compared.

For example if there are 10 letters 10/2 = 5.

abcdeedcba

If there are 11 letters, 11/5= 5.5, also 5. The 6th letter won't matter in this palindrome because it doesn't have to match another character.

abcdefedcba

Once we have the number of pairs [L/2], we need only run a loop,

as 'i' goes from 1 to [L/2]

check that "character i" = "character L+1-i"

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

1. Generate a random word of length n

2. Take generated word and make a copy

3. Reverse copied word

4. Append to original word

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Algorithm to find whether given string is palidrome?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

A Write the algorithm to concatenate two given strings?

a write the algorithm to concatenate two given string


What is the palidrome for a kind of reception given by the mayor of a city?

civic


What is complsexity of an algorithm?

Complexity of an algorithm is a measure of how long an algorithm would take to complete given


How do you write method pubic boolean containsString s Return whether the given string is in the array or not?

Return an iterator to the string if it exists, or the container's end iterator if it does not.


Write an algorithm to check whether the given number is odd or even?

Type your answer here... i think we should first enter 1 number then check it


Why algorithm needs to solve programming problem?

This is the definition of an algorithm - a list of orders of how to solve a given programming problem.


What is Vector generation algorithm?

It is a basic algorithm for generating lines on computer screen. line is generated between given 2 endpoints


In term of computer science what is deterministic algorithm?

In computer science, deterministic algorithm is an algorithm which, given a particular input, always produces the same result. This is used to increase the efficiency of machines.


How do you get odd ascii letters from a given string using string copy?

there is no such method using string copy


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


Write an algorithm and draw a corresponding flowchart to find the greatest number and its position among the 6 given numbers?

Algorithm Step1: Read A, B, C Step2: If A > B is True, then check whether A > C, if yes then A is greatest otherwise C is greatest Step3: If A > B is False, then check whether B > C, if yes then B is greatest otherwise C is greatest Give the Flowchart Answer


Program to check that given string is palindrome or not in C?

/*To check whether a string is palindrome*/includeincludevoid main () { int i,j,f=0; char a[10]; clrscr (); gets(a); for (i=0;a[i]!='\0';i++) { } i--; for (j=0;a[j]!='\0';j++,i--) { if (a[i]!=a[j]) f=1; } if (f==0) printf("string is palindrome"); else printf("string is not palindrome"); getch (); }