Sale!

Computer Programming II Assignment 5

$22.00

CS 1713
Introduction to Computer Programming II
Assignment 5

1. (100 pts) Write a program to find the largest palindrome in a string. A palindrome is a
sequence that reads the same backward as forward. racecar, eve, kayak are some examples.
For this assignment implement the following function
int palindromelength(char *str, int i, int j)
This function takes a string str and two points i and j and determines whether the string
from i to j is a palindrome. If it is a palindrome, it returns the length of the palindrome and
if it is not a palindrome, it returns -1.

Category:
5/5 - (2 votes)

CS 1713
Introduction to Computer Programming II
Assignment 5

1. (100 pts) Write a program to find the largest palindrome in a string. A palindrome is a
sequence that reads the same backward as forward. racecar, eve, kayak are some examples.
For this assignment implement the following function
int palindromelength(char *str, int i, int j)
This function takes a string str and two points i and j and determines whether the string
from i to j is a palindrome. If it is a palindrome, it returns the length of the palindrome and
if it is not a palindrome, it returns -1.
Consider the following string as an example
ABCBAHELLOHOWRACECARAREYOUIAMAIDOINEVERODDOREVENNGGOOD
It has many palindromes in it including ABCBA, RACECAR, ARA, IAMAI. Largest palindrome is NEVERODDOREVEN since it has the most characters in it.
Sample execution is given below
Enter a string
ABCBACDCBAAB
Largest palindrome is ABCBA
Submit your program electronically using the blackboard system
The program you submit should be your own work. Cheating will be reported to office of academic
integrity. Both the copier and copiee will be held responsible.

Open chat
Need help?
Hello
Can we help you?