Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.

Similar presentations


Presentation on theme: "Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting."— Presentation transcript:

1 Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting knuth (or turing or…) installing Debian 3.1 Engineering dept. the dumpster University of St. Petersburg On the 405, in traffic, being chased by police (and TV) helicopters. Mailing something at the Claremont Post Office Waiting for the snow enveloping you on Route 5 N to melt Krispy Kreme’s drive-through Teaching Honors English for Janice Barbee at Pomona High School Worldcom Headquarters Leading a Gray Davis / Gary Coleman / Arnold “T-800” Schwarzenegger gubernatorial fundraiser exploring martian soil Being dragged off-course 18 miles into a marathon race by a crazed spectator Massey University Palmerston North, NZ Pittsburgh Driving N on the Dalton Highway… (though it feels like it!) Victorville, for DARPA's UGC Waiting in line to vote in the Florida primaries… Denver, CO or Minneapolis, MN DC for the inauguration

2 What is this course about?

3 A chance to “improve” your programming skills Algorithm analysis and insight Program design and implementation optimizing coding time ACM programming contest What Why Research/prototype programming Hands-on practice with algorithms and techniques Unofficial course name: CS -70 Familiarity with Java’s libraries OR your choice of language "somewhat reasonable"

4 Last year's ACM regional programming contest Aaron Pribadi, Stuart Persteiner, and Daniel Lubarov Anak Yodpinyanee + Jason GarretGlaser Kevin Oelze, Andrew Hunter, and Kwang Ketcham Marquis Wang, Josh Ehrlich, and Daniel Fielder

5 Class Organization alternating format discussion sessions lab sessions problem and program analysis discussion of strategy and coding tips deciding on functional decomposition, data structures, language facilities, and algorithms to use in teams of 2-3 teams may use 1 machine per person (only the mock contest adheres to ACM rules) these problems count for each member of the group sometimes new problems, other times with known ones ~ 4 problems given out per week… a team can always practice with only 1 machine

6 Class Organization Feedback from prior semesters… make individual vs. team-based work clear, lectures vs. labs problems are always individually submitted -- but there should be an opportunity to start coding “cold” snacks and jotto! problems per person per week? about 1~2 (if you work on a team in lab) and consider all of the weeks of the term! each team member may submit shared lab problems submit for each person (email me if there are problems…) provide the code to all team members you may or may not choose to work as a team afterwards

7 Course Organization Jan 20 Welcome! Review of dynamic programming: 5 problems Jan 27 Lab/Mock contest session: 4 problems Feb 3 Discussion session on geometry problems: 4 problems Feb 10 Lab/Mock contest session: 4 problems Feb 17 Discussion session on graph problems: 4 problems Feb 24 Lab/Mock contest session: 4 problems Mar 3 No class (I'll be out of town – Chattanooga!) Mar 10 Discussion session on misc. algorithms Mar 17 Spring break Mar 24 Mock ACM contest, 9pm – 12:00am, 5 problems Mar 31 Discussion and wrap-up for the semester You may submit problems until the end of exams…CONTEST in San Diego ???

8 Course webpage references administrative info problem statements and sample data problems you have solved

9 Grading CS 189 is graded individually... (it’s possible to take it P/F, too) Coding Guidelines problems can be done any time during the semester discussion of algorithms always OK coding should be within teams you may use external references (but not solutions!) one person should take the lead on each problem use /cs/ACM/acmSubmit to submit try things out ! the reason for ACM! though not for CS elective credit…

10 Problem credits Problems are worth double if You solve them during the 4:15 - 5:30 lab sessions It's one of the "extra difficult" problems, which may be determined as we go… Any standard language is OK -- but do keep in mind that the competition allows only Java, C, and C++. Other "standard" languages: the team gets credit, up to 3 people somewhat reasonable alternatives will also be considered… C#, Python, Ruby Language Choice? Problems are worth triple if they are written up for "the book"

11 The "book" Overheard at last fall's contest… We will begin a multi-term effort to create an HMC "book" - need to be in Java or C++ a secret weapon? Problems contributed to the book are worth triple, but - need to be beautifully formatted - need to be fully commented - need to be useful for people who did not write it! - variable names and other constructs ~ evident Sign up for a problem if you want to do this. (It's OK to work in a team of 2 or 3, as well.) - need a thorough introductory explanation…

12 Spring 2008 summary: languages python 82 java 60 C++ 40 Tallies per problem and per language (thus far)… 17 (+2) 8416 (+2) 1 (+1) 6 (+1) 20 (+12) (+2) 3 (+1) 11211 (+1) 1 (+1) 17 (+9) (+2) 4 (+2) 1 228328 (+2) 13 (+10) 14 (+9) 121 (+16) (+4) 1115 (+14) number of 2x scores number of 4x scores d 8 ruby 6 scheme 3 lua 2 awk 2 js 2 sql cobol basic x86 asm pascal mathematica sh, latex 1 each

13 FroshSophsJrsSrsOthers pluto 0pluto 2pluto 3pluto 1 andes 1 andes 0andes 2andes 1 wired 1 wired 0 xenon 1 xenon 0 tenet 1tenet 0 tenet 3tenet 0 clack 2clack 1 clack 0clack 1 grime 1 grime 0 these 0these 1these 0these 4these 1 flour 0flour 2 flour 1 ACM Jotto finale: Fall '08 This has already set the record for the longest jotto game I've played at Mudd!

14 Dynamic programming!

15 Excitement from the judges’ room

16

17 Backpacks not permitted…

18 Dynamic programming When a seemingly intractable problem has lots of repeated substructure, go DP! Build a table of partial results. Replace computation with table look-up when possible For example:

19 Dynamic programming Build a table of partial results. Replace computation with table look-up when possible the binary-decimal problem, for example: 2 6 3 19 0 Numbers, N, up to 10 6 Input 0 marks the end of the input 10 1110 111 11001 the smallest decimal multiple of N with only the digits 0 and 1 ! Output Ideas? When a seemingly intractable problem has lots of repeated substructure, go DP!

20 One way… Count up to the solution, starting from 1… adding digits changes the error (remainder) in predictable ways insight: from CS 60!

21 Dynamic programming Storing intermediate results in a table for fast look-up: input N = 6 possible remainders upon dividing by N (6) # of digits in answer 012345 2 1 3 4

22 input N = 6 possible remainders upon dividing by N (6) # of digits in answer 012345 2 1 3 4 1 Dynamic programming Storing intermediate results in a table for fast look-up:

23 input N = 6 possible remainders upon dividing by N (6) # of digits in answer 012345 2 1 3 4 1 1011 1 Dynamic programming Storing intermediate results in a table for fast look-up:

24 input N = 6 possible remainders upon dividing by N (6) # of digits in answer 012345 2 1 3 4 1 111110 1011 1 1011 1 Dynamic programming Storing intermediate results in a table for fast look-up:

25 input N = 6 possible remainders upon dividing by N (6) # of digits in answer 012345 2 1 3 4 1 111110 1011 1 1011 1 1110 111110 1011 1 Dynamic programming Storing intermediate results in a table for fast look-up:

26 DP! Only checking values for which a remainder has not yet been used… Fast

27 Problem Set #0 (5 problems) Our ACM problems' mascot:

28 Problem Set #0 (4 problems) In teams of 2~3, read over these first three problems: Where does the structure of the problem depend on similar (but smaller!) substructure? Or not? Think of your next 5-letter jotto word… ! How might you build up a table of values toward an overall solution?

29 Another example binary-as-decimal problem The "haysale" problem Capacity of our farmer's hay bin Input Output Idea? maximum possible sum <= capacity 24 6 21 16 10 9 5 1 naïve running time? 24 Number of bales of hay Size of each bale of hay try all possible subsets?

30 Dynamic programming… Input 24 6 21 16 10 9 5 1 Capacity size of each bale Idea: keep a table of all possible capacities for bales 1..k bale 1 bale 2 bale 3 bale 4 bale 5 bale 6

31 Jotto: guesses #1 and 2… SophsJrsSrsGrads A word-guessing game similar to mastermind… ????? Frosh ?????

32 See you next Tuesday… bring a laptop, if you have one

33 The ACM regionals seemed to be channeling CS 60 ?!

34 Dinner…

35 This weekend's ACM regional programming contest Aaron Pribadi, Stuart Persteiner, and Daniel Lubarov Anak Yodpinyanee + Jason GarretGlaser Kevin Oelze, Andrew Hunter, and Kwang Ketcham Marquis Wang, Josh Ehrlich, and Daniel Fielder

36 This weekend's ACM regional programming contest Aaron Pribadi, Stuart Persteiner, and Daniel Lubarov Anak Yodpinyanee + Jason GarretGlaser Kevin Oelze, Andrew Hunter, and Kwang Ketcham Marquis Wang, Josh Ehrlich, and Daniel Fielder

37 HMC details Aaron Pribadi, Stuart Persteiner, and Daniel Lubarov Anak Yodpinyanee + Jason GarretGlaser Kevin Oelze, Andrew Hunter, and Kwang Ketcham Marquis Wang, Josh Ehrlich, and Daniel Fielder www.socalcontest.org

38 Thanks, Martijn! Scanner sc = new Scanner(System.in); even a bit easier! Martijn is shifty! Martijn is VERY shifty! Where is the table? This sure is sum code… to the max

39 Pebbles 3 8 6 7 9 1 4 6 1 Square array, up to 15x15, of integers from 1 to 99 Input DP Idea consider all possibilities for pebbling each row - they only depend on the previous row's best scores! Subset chosen (pebbles) 000001010011100101110111 Row # 0 1 2 abc Store the BEST score available for each possible subset.

40 3 8 6 7 9 1 4 6 1 Square array, up to 15x15, of integers from 1 to 99 Input DP Idea consider all possibilities for pebbling each row - they only depend on the previous row's best scores! Subset chosen (pebbles) 000001010011100101110111 Row # 0 1 2 abc Store the BEST score available for each possible subset. 0 68x39xx Pebbles

41 3 8 6 7 9 1 4 6 1 Square array, up to 15x15, of integers from 1 to 99 Input DP Idea consider all possibilities for pebbling each row - they only depend on the previous row's best scores! Subset chosen (pebbles) 000001010011100101110111 Row # 0 1 2 abc Store the BEST score available for each possible subset. 0 68x39xx 9 0+9 4 1+3 9 9+0 13 7+6 8 8+0 xxx Pebbles

42 3 8 6 7 9 1 4 6 1 Square array, up to 15x15, of integers from 1 to 99 Input DP Idea consider all possibilities for pebbling each row - they only depend on the previous row's best scores! Subset chosen (pebbles) 000001010011100101110111 Row # 0 1 2 abc Store the BEST score available for each possible subset. 0 68x39xx 9 0+9 4 1+3 9 9+0 13 7+6 8 8+0 xxx xxx 0+13 c +13 b +9 a +9 ? running time? What is the best here? Pebbles

43 binary-as-decimal problem "pebbles" problem (2007 ACM regionals) 71 24 95 56 54 85 50 74 94 28 92 96 23 71 10 23 61 31 30 46 64 33 32 95 89 Square array, up to 15x15, of integers from 1 to 99 Input Output 71 24 95 56 54 85 50 74 94 28 92 96 23 71 10 23 61 31 30 46 64 33 32 95 89 Idea place "pebbles" on integers, trying to maximize total, but no two pebbles may be adjacent… maximum possible sum 572 code Pebbles


Download ppt "Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting."

Similar presentations


Ads by Google