11-16 Class Notes CS 107

11-16 Class Notes CS 107 - placeWord( wordIndex + 1,...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Program #5 due tomorrow night at 11:59pm. Announcements: Questions? Recursion examples Last Time: Today: Palindrome checker using recursion (developed in class) Linked list introduction Comment on program Program comment: //instance variable: int bestOverlapSoFar = -1; // inside code for placeWord void placeWord( int wordIndex, int overlap) { // check for end of recursion if( wordIndex == NumberOfWords) { if( overlap > bestOverlapSoFar) { displayBoard(); bestOverlapSoFar = overlap; } return; } How to display only boards that have best overlap so far: for every row… for every column… int overlapForThisWord = overlap; // recursive call placeWord( wordIndex + 1, overlapForThisWord); 11-16 Class Notes CS 107 Wednesday, November 16, 2011 2:37 PM CS 107 Fall 2011 Page 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
// recursive call
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: placeWord( wordIndex + 1, overlapForThisWord); What is a palindrome? a word or phrase that reads the same forwards and backwards (sometimes excluding spaces and ignoring capitalization) What are well-known examples? Madam I'm Adam Able was I ere I saw Elba A man a plan a canal Panama Rats live on no evil star Race Car level civic bob A How could we do this iteratively? How about recursively? See code posted online that we developed in class. How to change this to ignore spaces? Palindrome checker: Why linked lists? Intuition example, then code example [The example below taken from online Java / Linked List notes.] Linked List introduction CS 107 Fall 2011 Page 2 CS 107 Fall 2011 Page 3 CS 107 Fall 2011 Page 4...
View Full Document

This note was uploaded on 02/10/2012 for the course COP 2273 taught by Professor Lin during the Fall '11 term at University of Central Florida.

Page1 / 4

11-16 Class Notes CS 107 - placeWord( wordIndex + 1,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online