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

Slides:



Advertisements
Similar presentations
A C++ Crash Course Part II UW Association for Computing Machinery Questions & Feedback.
Advertisements

. STL: C++ Standard Library (continued). STL Iterators u Iterators are allow to traverse sequences u Methods  operator*  operator->  operator++, and.
Contest format 5 hours, around 8-12 problems One computer running (likely)Linux, plus printer 3 people on one machine No cell phones, calculators, USB.
CSE Spring 2015 INTERMEDIATE PROGRAMMING
Templates and the STL Bryce Boe 2012/09/10 CS32, Summer 2012 B.
CS 300 – Lecture 3 Intro to Computer Architecture / Assembly Language Digital Design II.
Standard Containers: Vectors
Wednesday, 12/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Wednesday, 12/11/02  QUESTIONS??  Today: CLOSING CEREMONIES!  HW #5 – Back Monday (12/16)
CS 315 Data Structures B. Ravikumar Office: 116 I Darwin Hall Phone: Course Web site:
Lecture 20 “Standard” Template Library. What is the Standard Template Library? A collection of C++ classes (templates) containers vectors lists stacks.
Templates & STL Instructor: 小黑. Templates  Template serves as a class outline, from which specific classes are generated at compile time.  One template.
CS112 Intro to CS II with C++ Introduction. 6/25/2015Gene Itkis; cs1122 Problems and Programs Program helps articulate structure of Problem, and maybe.
COMP171 Data Structures and Algorithm Huamin Qu Lecture 1 (Sept. 1, 2005)
COMP171 Data Structures and Algorithm Qiang Yang Lecture 1 ( Fall 2006)
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 16 Exceptions,
Discussion Section: HW1 and Programming Tips GS540.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
Dr. Yingwu Zhu STL Vector and Iterators. STL (Standard Template Library) 6:14:43 AM 2 A library of class and function templates Components: 1. Containers:
DATA STRUCTURES ACM EXECUTIVE BODY 2k11.  A series of elements of same type  Placed in contiguous memory locations  Can be individually referenced.
Data Structures Using C++ 2E
School of Computing and Information Systems CS 371 Web Application Programming PHP - Basics Serving up web pages.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
Introduction. 2COMPSCI Computer Science Fundamentals.
ACM notes Can work on the problems anytime throughout the term Contest conflict -- The GRE subject test is Nov. 10th! int x; while (cin >> x) { cout
Introduction to STL and the vector container class CS342 Data Structures Based on Ford & Topp.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Standard Template Library (STL)
Curricularizing the ACM... ? Zach Dodds ~ November 13, 2010.
CS-2851 Dr. Mark L. Hornick 1 CS-2852 Data Structures Dr. Mark L. Hornick Office: L341 Phone: web: people.msoe.edu/hornick/
1 CSE1301 Computer Programming: Revision. 2 Topics Type of questions What do you need to know? About the exam Exam technique Staff consultation Revision.
Linked Lists part 2 CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and Computer Science University.
ACM today This week's problems… New and improved :-) ACM table slacking! not slacking… missing entries? let me know…
EECS 110: Introduction to Programming for Non-Majors Aleksandar Kuzmanovic Northwestern University
ACM reminders October HMC Mock contest 9: :30 November regional contest This is the next ACM meeting !! Contest-like problems dynamic.
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
CS342 Data Structures End-of-semester Review S2002.
Standard Template Library The Standard Template Library was recently added to standard C++. –The STL contains generic template classes. –The STL permits.
CS 403, Class 23Slide #1 CS Programming Languages Class 23 November 16, 2000.
A chance to “improve” your C/C++ … Preparation for the ACM competition... Problem Insight and Execution... Get into the minds of the judges Anxiety! 1.
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
ACM reminders October HMC Mock contest Good times ? November ACM contest November Final acm class & contest wrap-up PendingAzusa Pacific.
CS 403: Programming Languages Lecture 24 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
ACM notes Why… ? Not always an easy question! Entropy problem -- Huffman Codes InputOutput A..AB..BC..CD..DE..EF compression ratio, to 1 place.
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2002 Sections Ms. Susan Mitchell.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Summary CGS 3460, Lecture 43 April 26, 2006 Hen-I Yang.
Dr. Sajib Datta CSE Spring 2016 INTERMEDIATE PROGRAMMING.
C++ Review STL CONTAINERS.
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 383 Object-Oriented Programming & Design Lecture 25 Martin van Bommel.
ACM notes Sometimes a problem is much more difficult than expected! Basic approach:
Principles of Imperative Computation Lecture 1 January 15 th, 2012.
Dr. Sajib Datta Jan 15,  Instructor: Sajib Datta ◦ Office Location: ERB 336 ◦ Address: ◦ Web Site:
Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports clinic liaison phone call coding chunky strings rebooting.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Assignment 5 is posted. Exercise 8 is very similar to what you will be doing with assignment 5. Exam.
Computer Programming in C++ 黃鐘揚 教授 Prof. Chung-Yang (Ric) Huang Department of Electrical Engineering National Taiwan University 2007/06/26.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CS5040: Data Structures and Algorithms
CSE1320 INTERMEDIATE PROGRAMMING
Lecture 1: Welcome to CSE 373
Computer Engineering Department Islamic University of Gaza
An Introduction to STL.
Presentation transcript:

Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports Lecture clinic liaison phone call coding chunky strings rebooting turing reading requests 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

What is this course about? A chance to “improve” your C/C++ …

What is this course about? A chance to “improve” your C/C++ … Unofficial course name: CS -70

What is this course about? A chance to “improve” your C/C++ … Unofficial course name: CS -70 Code commenting Using globals Building classes STL Memory Leaks

What is this course about? A chance to “improve” your C/C++ … Unofficial course name: CS -70 Code commenting Using globals Building classes STL Memory Leaks CS 70

What is this course about? A chance to “improve” your C/C++ … Preparation for the ACM competition... Problem Insight and Execution... Unofficial course name: CS -70 Code commenting Using globals Building classes STL Memory Leaks CS 70

2000 ACM Teams

Organization Solving problems in teams 3 team members, more or less 2 problems/week, more or less submission through /cs/ACM/acmSubmit class web page at a must!

Grading P/F by default -- but it can be graded Coding Guidelines 1.75 problems/week => A 1.25 problems/week => B 0.75 problems/week => C 0.25 problems/week => D share coding tasks within teams, not among them discussion of algorithms always OK start from scratch each time!

Course Outline Sep 11 continental fare Sep 18 slim jims Sep 25 Pepperedge Farm Oct 2 Krispy Kreme Oct 9 Drake’s coffee cake Oct 16 baklava Oct 23 (fall break) Oct 30 HMC Contest - 9:00 pm to 1:00 am ? Nov 6 popcorn Nov 10 (Sat) -- ACM Contest at Riverside Com. Col. Nov 13 Wrap-up and problem discussion

ACM topics Standard Library (STL) Algorithms/data structures Coding/Contest strategies ContestCSTopic Overlearning the above

ACM topics Standard Library (STL) Algorithms/data structures Coding/Contest strategies ContestCSTopic Overlearning the above

ACM topics Standard Library (STL) Algorithms/data structures Coding/Contest strategies ContestCSTopic Overlearning the above

ACM topics Standard Library (STL) Algorithms/data structures Coding/Contest strategies ContestCSTopic Overlearning the above

Problems Intergalactic IRC strings Input: The “echo” problem. (echo.cc) stdin The “unscramble” problem. (unscramble.cc) The “digital root” problem. (digroot.cc) starting... sorting... hehelllloo spamanyspamone howstheweather

Problems Intergalactic IRC strings Input: Status Report Output: The “echo” problem. (echo.cc) stdin stdout The “unscramble” problem. (unscramble.cc) The “digital root” problem. (digroot.cc) starting... sorting... An echo string with buffer size ten Not an echo string, but still consistent Not consistent with the theory hehelllloo spamanyspamone howstheweather

Resources... Online STL refs Useful stuff for this week’s problems Both good overall references Example code string string t, s = “Hawaii 2002”; getline(cin,t); // suppose t is “Harvey Mudd” if (t > s) … // comparison (==, !=, …) t += ‘ ’ + ‘i’ + “n ” + s; // concatenation s = t.substr(7,4); // s is “Mudd” s[1]; // s[1] is ‘u’ s.length(); // returns 4 t.find(‘a’); // returns 1 (where ‘a’ is) t.find(‘a’,2); // returns 16 (starts at 2) // find returns a value of type string::size_type // if what is sought isn’t there, find returns string::npos #include

Resources... pair typedef pair PS; PS mypair = make_pair(“hello”,“world”); mypair.first; // these are public members mypair.second; struct MYLESS : public less { bool operator()(PS x,PS y) { return x.second < y.second; // etc. } }; MYLESS mybad; PS* psArray = new PS[1000]; // array of PS // putting mybad to work... sort( psArray, psArray+n ); // default sort sort( psArray, psArray+n, mybad ); #include sort #include function objects #include “less”

Resources... pair typedef pair PSS; PSS mypair = make_pair(“hello”,“world”); mypair.first; // these are public members mypair.second; vector v; // typedefs ~ good v.reserve(10); // assure 10 spots v.push_back(mypair); // mypair -> last item v.back(); // returns mypair v.pop_back(); // removes last element v.size(); // # of elements v[i]; // ith element sort( v.begin(), v.end() ); // default sort sort( v.begin(), v.end(), mycompare ); #include sort #include vector #include

Intro STL Data Structure The number of configurations the # of cups to follow the # of peas in each cup # of cups # of peas... Input: The # of transitions from a root configuration to the given one. Output: 3232 The “split pea” problem (also see the webpage) stdin stdout input output shaken or stirred?

Intro Problem The “NAND” problem (also see the webpage) file to create: nand.cc Problem NAND gates can specify any logical function. Consider two N-bit binary numbers, A and B. There is a logical function mapping A and B to the overflow bit of their sum. A = 10 B = 11 A+B = 101 NAND x y x|y the overflow bit -- it’s a function of the input bits

Intro Problem The “NAND” problem (also see the webpage) file to create: nand.cc Problem: NAND gates can specify any logical function. Consider two N-bit binary numbers, A and B. There is a logical function mapping A and B to the overflow bit of their sum. Lines with two integers > 0.Input: Same lines, plus the max # of steps to get to 1 in the given range. Output:

Topics Outline Sep 5 Basic coding strategies (ACM style) Sep 12 Dynamic programming ’n’ data structures Sep 19 Search algorithms ’n’ data structures Sep 26 Numerical algorithms: DEs, equations Oct 3 I/O in C/C++ = building parsers quickly Oct 10 Built-in string functions: strcmp, strtok, and the like Oct 24 Built-in math functions: atan vs. atan2, precision issues,... Oct 31 Geometric algorithms ‘n’ data structures Nov 7 Contest strategies, logistics, preparing materials

A chance to “improve” your C/C++ … Preparation for the ACM competition... Problem Insight and Execution... Get into the minds of the judges Anxiety! 1 2 prog practice What is this course about?

Get into the minds of the judges Key Skill #1: mindreading

Key Skill #2: anxiety Anxiety!

What, no contest!? We will have a mock contest at the end of the term. tentatively Tuesday, April 17 four hours (from 4:15 to 8:15) contest conditions will apply dinner will be provided... - only written material can be used - only one machine per team - (we will have a chair for each team member) - minimal feeback from submissions - time penalties for incorrect submssions This will be the final class session except we’ll stretch team size to 1-4 people...

Data Structures Sep 11 make_pair string Sep 18 map, multimap, set, multiset Sep 25 vector, deque, list Oct 2 bitset, stack,... Oct 9 algorithms I Oct 16 algorithms II Oct 23 (fall break) Oct 30 HMC Contest - 9:00 pm to 1:00 am ? Nov 6 I/O tips Nov 10 (Sat) -- ACM Contest at Riverside Com. Col. Nov 13 Wrap-up and problem discussion

printed version after this one

Welcome to Programming Practicum “Putting the C into CS” You aren’t here writing clinic reports Lecture clinic liaison phone call coding chunky strings rebooting turing reading requests 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

What is this course about? A chance to “improve” your C/C++ … Preparation for the ACM competition... Problem Insight and Execution... Solving problems in teams 3 team members, more or less 2 problems/week, more or less submission through /cs/ACM/acmSubmit class web page at

Grading P/F by default -- but it can be graded Coding Guidelines 1.75 problems/week => A 1.25 problems/week => B 0.75 problems/week => C 0.25 problems/week => D share coding tasks within teams, not among them discussion of algorithms always OK start from scratch each time!

ACM topics Standard Library (STL) Algorithms/data structures Coding/Contest strategies ContestCSTopic Overlearning the above

“Problems” Intergalactic IRC strings Input: The “echo” problem. (echo.cc) stdin The “unscramble” problem. (unscramble.cc) The “digital root” problem. (digroot.cc) starting... sorting... hehelllloo spamanyspamone howstheweather

“Problems” Intergalactic IRC strings Input: Status Report Output: The “echo” problem. (echo.cc) stdin stdout The “unscramble” problem. (unscramble.cc) The “digital root” problem. (digroot.cc) starting... sorting... An echo string with buffer size ten Not an echo string, but still consistent Not consistent with the theory hehelllloo spamanyspamone howstheweather

Resources... Online STL refs Useful stuff for this week’s problems Both good overall references Example code string string t, s = “Hawaii 2002”; getline(cin,t); // suppose t is “Harvey Mudd” if (t > s) … // comparison (==, !=, …) t += ‘ ’ + ‘i’ + “n ” + s; // concatenation s = t.substr(7,4); // s is “Mudd” s[1]; // s[1] is ‘u’ s.length(); // returns 4 t.find(‘a’); // returns 1 (where ‘a’ is) t.find(‘a’,2); // returns 16 (starts at 2) // find returns a value of type string::size_type // if what is sought isn’t there, find returns string::npos #include

Resources... pair typedef pair PS; PS mypair = make_pair(“hello”,“world”); mypair.first; // these are public members mypair.second; struct MYLESS : public less { bool operator()(PS x,PS y) { return x.second < y.second; // etc. } }; MYLESS mybad; PS* psArray = new PS[1000]; // array of PS // putting mybad to work... sort( psArray, psArray+n ); // default sort sort( psArray, psArray+n, mybad ); #include sort #include function objects #include “less”