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

Slides:



Advertisements
Similar presentations
ACM Programming Team Bill Punch. ACM Programming Contest One of the premier programming competitions. Held every year since 1977 MSU was the winner that.
Advertisements

Jotto! JRsSRsElderly slate 3 This term's first class to guess another's word earns 1 problem... slate 2slate 1 This term's last class to have its word.
 Computer Science 1MD3 Introduction to Programming Winter 2014.
Intro to CIT 594
Overview What is Dynamic Programming? A Sequence of 4 Steps
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
Dynamic Programming.
David Luebke 1 5/4/2015 CS 332: Algorithms Dynamic Programming Greedy Algorithms.
Programming TBE 540 Farah Fisher. Objectives After viewing this presentation, the learner will be able to… Given a task, create pseudocode Given pseudocode,
Jotto! SophsJrsSrs audio 1audio 2audio 1 Frosh audio 2 graze 3graze 1 graze 2 alloy 1 alloy 2 fresh 2fresh 1fresh 2fresh 1 This term's first class to guess.
Intro to CIT 594
Intro to CIT 594
HW 1: Problems 3 & 4 EC 1 & 2.
Programming Competitions as a Basis for an Algorithms and Data Structures Course John Paxton Montana State University CCSC - NW Friday, October 12, 2007.
CS503: Tenth Lecture, Fall 2008 Review Michael Barnathan.
Chapter 2 Writing Simple Programs
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Analysis of Algorithms
Slide 1. Slide 2 Administrivia Nate's office hours are Wed, 2-4, in 329 Soda! TA Clint will be handing out a paper survey in class sometime this week.
Lecture 7 Topics Dynamic Programming
Test Preparation Strategies
Intro to CIT 594
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
David Luebke 1 8/23/2015 CS 332: Algorithms Greedy Algorithms.
ACM Schedule… 2/23 Geometry problems 3/2 Lab problems (geometry!) 3/30 "Mock" competition and lab session (4:15) 3/9 Final algorithm discussion… 3/16 [Spring.
ACM Programming Contests
Welcome to Programming Practicum You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting knuth (or turing or…)
1 What NOT to do I get sooooo Frustrated! Marking the SAME wrong answer hundreds of times! I will give a list of mistakes which I particularly hate marking.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
There are only 10 types of people in the world, those who understand binary and those who don't.
COMP 111 Programming Languages 1 First Day. Course COMP111 Dr. Abdul-Hameed Assawadi Office: Room AS15 – No. 2 Tel: Ext. ??
COMP Introduction to Programming Yi Hong May 13, 2015.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011.
ADA: 7. Dynamic Prog.1 Objective o introduce DP, its two hallmarks, and two major programming techniques o look at two examples: the fibonacci.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
CSCI 51 Introduction to Computer Science Dr. Joshua Stough January 20, 2009.
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
David Luebke 1 10/24/2015 CS 332: Algorithms Greedy Algorithms Continued.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports Lecture clinic liaison phone call coding chunky strings.
CSC 413/513: Intro to Algorithms Greedy Algorithms.
Curricularizing the ACM... ? Zach Dodds ~ November 13, 2010.
ACM today Some nice unix commands… practice problems? code.google.com/codejam/ This week: beyond Floyd-Warshall.
Greedy Methods and Backtracking Dr. Marina Gavrilova Computer Science University of Calgary Canada.
Honors Track: Competitive Programming & Problem Solving Optimization Problems Kevin Verbeek.
ACM today This week's problems… New and improved :-) ACM table slacking! not slacking… missing entries? let me know…
1 Programming for Engineers in Python Autumn Lecture 12: Dynamic Programming.
June 19, Liang-Jun Zhang MTWRF 9:45-11:15 am Sitterson Hall 011 Comp 110 Introduction to Programming.
Evaluation & Assessment 10/31/06 10/31/06. Typical Point Breakdown COURSE GRADES: Grades will be assigned on the basis of 450 points, distributed as follows:
Provinci summer training 2010 June 17: Recursion and recursive decent parser June 24: Greedy algorithms and stable marriage July 1: Holiday July 8: Math.
Tallahassee, Florida, 2015 COP4710 Database Systems Project Overview Fall 2015.
Intro to CIT 594
Dynamic Programming David Kauchak cs161 Summer 2009.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
CISC105 – General Computer Science Class 4 – 06/14/2006.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
Harbin, China 2010 finals ACM today… ! (2009) Knapsack DP for NP! Floyd-Warshall DP for APSP! Max Flow.
Software Engineering Algorithms, Compilers, & Lifecycle.
Programming Mehdi Bukhari.
Problem Solving: Brute Force Approaches
Problem Solving.
Dynamic Programming.
Problem Solving Using C: Orientation & Lecture 1
ACM today… ! DP for NP! DP for APSP! Knapsack Floyd-Warshall
Problem Solving Using C: Orientation & Lecture 1
Dynamic Programming.
Trevor Brown DC 2338, Office hour M3-4pm
CISC101 Reminders Assignment 3 due today.
Presentation transcript:

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 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 Urban Granc Challenge Waiting in line to vote in the Florida primaries… Denver, CO or Minneapolis, MN DC for the inauguration On fire just W of here!! Harbin!

Introductions! Zach Dodds Office Olin fan of low-tech games fan of low-level AI

Atari 2600 Adventure!

What is this course about?

A chance to improve your programming skills Algorithm analysis and insight Program design and implementation optimizing coding time, not running 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 "reasonable"

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~5 problems given out per week… a team might want to practice with only 1 machine

Class Organization Feedback from prior semesters… make individual vs. team-based work clear problems can be done individually or in teams of 2 there should be an opportunity to start coding “cold” (true in labs) 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! up to 3 people, during the lab "mock contest" sessions each person submits their own afterwards provide the code to all team members you may choose to work as a team afterwards, but don't have to better support for newcomers and for contest problems!

Course Organization Sep 7 Welcome! and DP problems ~ 4.5 problems Sep 14 Lab session ~ 4.5 problems Sep 21 Discussion session on geometry problems ~ 4.5 problems Sep 28 Lab session ~ 4.5 problems (unless there is a clinic trip) Oct 5 Discussion on the ACM contest's history (Don Chamberlain) Oct 12 Discussion session on graph problems ~ 4.5 problems Oct 19 Lab & local ACM qualifying contest ~ 6 problems Oct 26 Discussion session on something you haven't seen? ~ 4.5 problems Nov 2 Lab session ~ 4.5 problems Nov 9 No meeting (organizing teams to Riverside...) Nov 13 (Sat.) ACM Regional contest (in Riverside...) Nov 16 Final meeting (may be a make-up lab for 9/28) You may submit problems until the end of exams… ≥ 36 problems total

Last year's ACM regional contest

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

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 any references except an existing solution or partial solution… one person should take the lead on each problem use /cs/ACM/acmSubmit to submit on knuth try things out ! the reason for CS 189! though not for CS elective credit…

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 (so far): the team gets credit, if in a team reasonable alternatives will also be considered… C#, Python, Ruby, Perl, PHP, Haskell, Lua, Clojure, Lisp Language Choice?

A prior term's summary: languages python 82 java 60 C++ 40 Tallies per problem and per language… 17 (+2) 8416 (+2) 1 (+1) 6 (+1) 20 (+12) (+2) 3 (+1) (+1) 1 (+1) 17 (+9) (+2) 4 (+2) (+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

This week's problems These 3 problems are worth 0.5 points, but 1 point if solved "in lab." Cows are the global theme of CS189's problems.

The ave problem MIX That number of "Hello, World"s – in Latin. Input Ave, Mvnde!... Ave, Mvnde! Output Farmer Alvarado's roman numeral If it's not a valid roman numeral, output nocens numerus total of 1009 of these i.e., bad number The Hello, world! collection

"Hello, World" of the day! sine & cosine functions! from math import * def f(x): return int(round( *cos(x*1.118)\ *sin(x*1.118)\ *cos(2*x*1.118)\ *sin(2*x*1.118)\ *cos(3*x*1.118)\ *sin(3*x*1.118)\ *cos(4*x*1.118)\ *sin(4*x*1.118)\ *cos(5*x*1.118)\ *sin(5*x*1.118))) print "".join([chr(f(x)) for x in range(12)])

"Hello, World" of the day! How does it work? Here is "Hello World"

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

Dynamic programming? Action!

Dynamic programming!

The subseq problem THEQUICKBROWNCOW JUMPEDOVERADOG The number of the longest common subsequence bewteen s1 and s2. Input Cow label sequence #2 (s2) 3 Output Cow label sequence #1 (s1) what is it?

The subseq problem s1 = "THEQUICKBROWNCOW" Input Output LCS( i1, i2 ) = length of longest common subsequence of s1 up to i1 and s2 up to i2 s2 = "JUMPEDOVERADOG" overlapping subproblems (1) Write your solution recursively, in terms of these. (2) Make sure you don't call any subproblem more than once! Strategy

The subseq problem s1 = "THEQUICKBROWNCOW" Output LCS( i1, i2 ) = length of longest common subsequence of s1 up to i1 and s2 up to i2 s2 = "JUMPEDOVERADOG" LCS( i1, i2 ) =

Recursive LCS import sys sys.setrecursionlimit(100000) def LCS( i1, i2 ): """ classic LCS: s1 up to i1 vs. s2 up to i2, inclusive """ if i1 < 0 or i2 < 0: return 0 result = Compute LCS recursively! return result if __name__ == "__main__": s1 = raw_input() s2 = raw_input() result = LCS( len(s1)-1, len(s2)-1 ) print result

import sys sys.setrecursionlimit(100000) D = {} def LCS( i1, i2 ): """ classic LCS: s1 up to i1 vs. s2 up to i2, inclusive """ global D if i1 < 0 or i2 < 0: return 0 if (i1,i2) in D : return D [(i1,i2)] # memoized!! result = Compute LCS recursively! D [(i1,i2)] = result # memoized!! return result if __name__ == "__main__": s1 = raw_input() s2 = raw_input() result = LCS( len(s1)-1, len(s2)-1 ) print result Avoiding repeated calls... remember old calls & don't recompute them Memoize

Avoiding repeated calls... remember old calls & don't recompute them MemoizeDynamic Programming make each call once and store it in a table import sys sys.setrecursionlimit(100000) class memoize: def __init__(self, function): self.function = function self.memoized = {} def __call__(self, *args): try: return self.memoized[args] except KeyError: self.memoized[args] = self.function(*args) return def LCS( i1, i2 ): # definition here Python's "function decorator" syntax!

Avoiding repeated calls... remember old calls & don't recompute them MemoizeDynamic Programming make each call once and store it in a table if __name__ == "__main__": s1 = raw_input() s2 = raw_input() D = {} # empty table for i1 in range(len(s1)): for i2 in range(len(s2)): D[(i1,i2)] = LCS implementation! print D[(len(s1)-1, len(s2)-1)]

Jotto! SophsJrsSrsProfs A word-guessing game similar to mastermind… ? 0 This term's winning team earns 1 problem (per person)... ? 0

Try these...

Fall '09 Jotto: tied for the longest game yet… SophsJrsSrsOthers icily 0 icily 1 strep 2 strep 1 spork 1spork 3spork 0 spend 2 peeps 2peeps 1peeps 2peeps 1 furls 1 furls 0furls 1 Ghost 2Ghost 1 Ghost 0 Tanks 2Tanks 1Tanks 2Tanks 1 Gecko 2Gecko 1

Dynamic programming? practice contest…

Dynamic programming? Action!

Excitement from the judges’ room

Harbin