nifty assignments

16
Nifty Assignments Shamelessly Borrowed from Nick Parlante at Stanford University

Upload: laddie

Post on 14-Jan-2016

57 views

Category:

Documents


1 download

DESCRIPTION

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/ - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Nifty Assignments

Nifty Assignments

Shamelessly Borrowed from Nick Parlante at Stanford University

Page 2: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 2

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

Page 3: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 3

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

Page 4: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 4

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

Page 5: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 5

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.”

Page 6: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 6

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

Page 7: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 7

Name Surfer• Students must read in and store the names, search the

names, and complete a GUI to show the names

Where did allthe Ethels go?

Page 8: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 8

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

Page 9: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 9

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

Page 10: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 10

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

Page 11: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 11

Word Laddersmartscart (a type of audio / video connector)scantslantplantplaitplainblain (an inflammatory swelling or sore) brain

• My word list was derived from a Scrabble word list.

Page 12: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 12

Word Ladder• 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

smart

scart

start

swart

smalt

smarm

scant

scare

Page 13: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 13

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

Page 14: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 14

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?

Page 15: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 15

Word Ladders• smart to brain

• Linear search method – 0.991 seconds

• Binary search method – 0.260 seconds

• How can that be?

Page 16: Nifty Assignments

UTCS Teachers Camp Nifty Assignments 16

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