160 likes | 316 Views
Nifty Assignments. Shamelessly Borrowed from Nick Parlante at Stanford University. A Little History. Began as a small panel discussion at SIGCSE in 1999 Friends of Nick Parlante would present cool assignments Now the “800 pound gorilla” of SIGCSE original web site nifty.stanford.edu/
E N D
Nifty Assignments Shamelessly Borrowed from Nick Parlante at Stanford University
A Little History • Began as a small panel discussion at SIGCSE in 1999 • Friends of Nick Parlante would present cool assignments • Now the “800 pound gorilla” of SIGCSE • original web site • nifty.stanford.edu/ • AP Central has a similar page Nifty Assignments
Start With the Problem • Greg Lavender - “Start with the Problem” • Motivate what needs to be learned with an interesting problem • Biology teacher I knew started his year with the question “What is food?” • I think CS actually has it easy because we can actually solve interesting problems in our labs. • students get immediate feedback and can create non trivial artifacts Nifty Assignments
What Makes an Assignment Nifty? • Not the same answer for everyone • I think determining if a 400 digit number is prime is an a very interesting problem • algorithmically interesting with many approaches • look at efficiency of solutions • data representation is interesting • relevant -> Encryption techniques such as RSA • A lot of my students DON’T find this as interesting as I do Nifty Assignments
What Makes an Assignment Nifty? • they are fun, playful, interesting • they are often, but not always visual. • they are scalable. Top students can run with them, others can complete the basics • they fulfill Astrachan’s Law • Owen Astrachan – “Do not given an assignment that computes something that is more easily figured out without a computer such as the old Fahrenheit / Celsius conversion problem.” Nifty Assignments
Example 1 – Name Surfer • From Nick P. • The Name Surfer • Social Security Administration “popular baby names” web site. • www.ssa.gov/OACT/babynames/ • Data on names of children born in US • Assignment uses list of 1000 most popular names by decade stored in a text file Nifty Assignments
Name Surfer • Students must read in and store the names, search the names, and complete a GUI to show the names Where did all the Ethels go? Nifty Assignments
Name Surfer • Handout has fairly detailed step by step instructions on how to approach the problem • Components • modular design • multiple classes • using ArrayLists and other classes • calculations for lines on display • Scalable • do simple text based, then add window, then add GUI • don’t provide data file, have students create it from multiple files Nifty Assignments
Name Surfer • Use the tool you have created to investigate naming trends • plot grand parents names • Rock, Trinity, Dwight • Jose, Mohammed • Mike and Michael, Dave and David, Matt and Matthew • J, D, M Nifty Assignments
Example 2 – Word Ladders • Proposed by Owen Astrachan • Begin with two 5 letter words and a list of valid 5 letter words: • brain, smart • Change one letter of start word for next word • New word be in the list of valid words Nifty Assignments
Word Ladder smartscart (a type of audio / video connector)scantslantplantplaitplainblain (an inflammatory swelling or sore)brain • My word list was derived from a Scrabble word list. Nifty Assignments
Word Ladder smart scart start swart smalt smarm scant scare • Actually exploring a graph • the nodes are the words • connections (or edges or links) exist between 2 words if they differ by a single letter Nifty Assignments
Word Ladder Assignment • I present an algorithm to students that does a breadth first search of the graph using a queue of stacks • Students must implement the stack and queue classes and then implement the algorithm • Components • implementing data structures • implementing algorithms • comparisons of efficiency Nifty Assignments
Word Ladder Assignment • How do you find words one letter different? • do a linear search of all words in the word list • O(N) • …but the word list is sorted. • Given a word generate all possible 5 letter combinations that are one letter different • smart -> amart, bmart, cmart, … smarx, smary, smarz (125 in all) • take these 125 words and search the word list for each one using a binary search • This can’t be faster can it? Nifty Assignments
Word Ladders • smart to brain • Linear search method – 0.991 seconds • Binary search method – 0.260 seconds • How can that be? Nifty Assignments
Word Ladders • Another extension • Do a depth first search • Ladders are much longer • smart – brain, 521 words in 0.140 seconds • The word list has about 8500 words • Other possible extensions: • start from both ends and work towards the middle • find all the connections up front • don’t provide the words in sorted order • map out all the independent sections, which is the biggest? • which word is closest to the center of the largest graph? • what is the largest ladder that exists? • other rules from Wikipedia Nifty Assignments