27-CS106X-Midterm

27-CS106X-Midterm - , CS106X Autumn 2010 Handout 27...

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

View Full Document Right Arrow Icon
, CS106X Handout 27 Autumn 2010 November 3 rd , 2010 CS106X Midterm Examination This is an open-note, open-reader exam. You can refer to any course handouts, textbooks, handwritten lecture notes, and printouts of any code relevant to any CS106X assignment. You may not use any laptops, cell phones, or handheld devices of any sort. Remote students taking the exam can telephone while taking it if they have questions: 415-205-2242. Once completed, fax the exam back to 650-723-6092, or scan and email to jerry@cs.stanford.edu . Good luck! Section Leader: _____________________ Last Name: _____________________ First Name: _____________________ I accept the letter and spirit of the honor code. I’ve neither given nor received aid on this exam. I pledge to write more neatly than I ever have in my entire life. (signed) __________________________________________________________ Score Grader 1. Superwords [8] ______ ______ 2. Stable Counting Sort [6] ______ ______ 3. Up-Down Words [8] ______ ______ 4. Dominosa [8] ______ ______ 5. The US Election [6] ______ ______ 6. Short Answer [4] ______ ______ Total [40] ______ ______
Background image of page 1

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

View Full DocumentRight Arrow Icon
2
Background image of page 2
3 Problem 1: Superwords [8 points] A superword is an English word where every prefix and every suffix is also a word (assuming that all the single letters— "a" , "b" , "c" , etc.—are English words). For instance, "amuser" is a superword, because all prefixes ( "a" , "am" , "amu" , "amus" , and "amuse" ) and all suffixes ( "muser" , "user" , "ser" , "er" , and "r" ) are English words as well. Neat! Implement the CollectLongestSuperwords , which given a reference to a Lexicon , returns all of the longest superwords as a Vector<string> . Your approach: You should iterate over the entire Lexicon, deciding whether each word is a superword, and if it’s among the longest of superwords you’ve seen so far, you should add it to the Vector<string>
Background image of page 3

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

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

Page1 / 12

27-CS106X-Midterm - , CS106X Autumn 2010 Handout 27...

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