CSCA08H3 Lecture 8: Week 8 Notes

89 views7 pages
1 Mar 2016
School
Course
Professor

Document Summary

Csc108h1f 2014: algorithm 3: can compare pairs of characters (last and rst character, second and second. If both halves are equivalent, it is a palindrome. If an odd number of character, you ignore the middle character (eg. e" in racecar"). last character, etc). If all the same, it is a palindrome. Again, if odd, you can ignore the middle character: the examples, type contract, header, and description were created (in that order) as shown to the right, note: the body and testing will be done in subsequent parts. Reminder: algorithm 1 uses the approach of comparing the reversed string to the original string to establish if it is a palindrome. Unlike lists, there is no reverse method or function for strings so we must create one: this function must reverse, for example, hello" to. Now we can create the function that checks if a string is a palindrome.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents