22C:16 Computer Science I: Fundamentals
Main section: 9:3010:20 MWF, Room W151 PBB
Evening section: 5:006:45 MW, Room 105 MLH
Instructors:
Sriram V. Pemmaraju (Main section)
101G MLH, srirampemmaraju@uiowa.edu, 3193532956
Office Hours: M 12:30, F 23:30
Steven P. Miller (Evening section)
201K MLH, stevenmiller@uiowa.edu, 3196216547
Office Hours: 6:457:45 MW, 5:306:30 Th
Computer Science I: Fundamentals is an introductory course on
computer programming with emphasis on problem solving techniques.
The course is the starting point for computer science major and minor curricula,
and also useful to other majors as an initial exposure to programming.
This semester the course has two sections.
The "main section" consists of three lectures per week, with an additional discussion section
once per week.
The "evening section" section meets twice a week, with no associated discussion sections.
Computational concepts are presented in the context of working examples
and exercises. The key programming topics include flowcontrol, data types, functions,
objects and classes. The course will use the Python programming language. Python can be used
interactively and can be accessed on Linux/Unix, Mac, and Windows platforms.
Syllabus document,
Information about TAs,
Announcements,
Quizzes, Projects, and Exams,
Weekly Topics,
Online Resources
(From xkcd)
Piyush Dubey Office hours: 11:301:00 W, 10:3012:00 F Office: 301 MLH Email: piyushdubey@uiowa.edu
Valerie Galluzzi Office hours: 5:307:00 T, 11:301:00 W Office: 301 MLH Email: valeriegalluzzi@uiowa.edu
Daniel Squires Office hours: 11:301:00 M, 1:002:30 W Office: 301 MLH Email: danielsquires@uiowa.edu
 Quiz 12 Solutions.
 Quiz 11 Solutions.
 Quiz 10 Solutions.
 Quiz 9 Solutions.
 Quiz 8 Solutions.
 Homework 9. Due at 5 pm on Friday, 5/4. How to detect line segment intersection?.
 Project 2 Phase 2 Test Files. Use these
to test your solution to Project 2, Phase 2.
 Project 2 Phase 1 Solution. Feel free to use this in Project 2, Phase 2.
 Homework 8. Due on Friday, 4/27.
 Test files for Project 2, Phase 1.
 mostFrequentTest.py: Test file for Problem 3 in Homework 7; The fifty most frequent words in "War and Peace". You can use this to check the correctness of your solution to
Problem 4 in Homework 7.
 Project 2. Phase 1 due at 5 pm on Friday, 4/20, Phase 2 due at 5 pm on Friday, 4/27. Project 2 Input Files.
 Homework 7. Due on Friday, 4/13. Data file war.txt for Problem 4.
 Solution to Phase 2, Project 1 and corrected test file for Project 1, Phase 2.
 Test file for Project 1, Phase 2 that is buggy!
 Solution to Phase 1, Project 1.
 Test file for Project 1, Phase 1.
 Homework 6. Due via ICON dropbox by 4:59 pm on Wednesday, 3/21. Homework 6 Solution.
 Project 1. Due via ICON dropbox by 4:59 pm on 3/23 (Phase 1), 3/28 (Phases 12), and 4/4 (the complete project). miles.dat, the data file you should use for Project 1.
 Quiz 7a Solution, Quiz 7b Solution, Quiz 7c Solution.
 Homework 5. Due via ICON dropbox by 4:59 pm on Wednesday, 3/7, Testing HW5 Solutions,
gradeDistributionTest.py (Problem 1), areCollinearTest.py (Problem 2),
collinearityTestTest.py (Problem 3), Homework 5 Solution.
 Quiz 6a Solution, Quiz 6b Solution, Quiz 6c Solution.
 Exam 1, Exam 1 Solutions.
 Quiz 5a Solution, Quiz 5b Solution, Quiz 5c Solution.
 Homework 4. Due via ICON dropbox by 4:59 pm on Thursday, 3/1.
 Quiz 4a Solution, Quiz 4b Solution, Quiz 4c Solution.
 Homework 3. Due via ICON dropbox by 4:59 pm on Wednesday, 2/15.
Homework 3 Solution.
 Quiz 3a Solution, Quiz 3b Solution, Quiz 3c Solution.
 Homework 1. Due via ICON dropbox by 4:59 pm on Wednesday, 2/1.
 Homework 2. Due via ICON dropbox by 4:59 pm on Wednesday, 2/8.
Homework 2 Solution.
 Quiz 2a Solution, Quiz 2b Solution, Quiz 2c Solution.
 Homework 1. Due via ICON dropbox by 4:59 pm on Wednesday, 2/1.
Homework 1 Solution.
 Quiz 1a Solution, Quiz 1b Solution, Quiz 1c Solution.
 3/21 Final endofsemester scores and letter grades.
 5/2 Information on the final exam.
 4/24 Prof. Steve Miller will have office hours this Saturday, April 28 starting at 3 pm.
 4/22 Project 2 has been updated with some additional information on "tie breaking" situations
that might arise in Phase 2 and how to deal with these.
 4/20 Here is a summary of all the end of semester deadlines for homeworks, quizzes, and projects.
 4/20 Project 2 Phase 2 deadline postponed to Monday, 4/30.
 4/20 Final Exam is on May 7, 5:30 pm to 7:30 pm in W10 PBB. More details soon.
 4/19 Project 2 has been updated with a small clarification in Phase 1 and few changes to Phase 2.
 4/18 Homework 8 has been posted.
 4/16 Prof. Steve Miller will be out of town on Thursday, 4/26 and will not hold office hours that day.
 4/4 I have updated Project 1 a little bit to specify names of files to submit, etc.
 4/4 I have updated the instructions for viewing kml files to provide explicit instructions for Windows users.
Take a look at Instructions for making and viewing kml files again.
 3/25 Practice Exam for Exam 2. The TAs will go over this
in Tuesday's (3/27) discussion section. This is from my Spring 2011 offering of the course and solutions are posted on that course page.
 3/25 Instructions for making and viewing kml files.
 3/23 Project 1 deadlines are all postponed as follows: Phase 1 is due on Monday, 3/26 at 5 pm, Phase 2 is due on Friday, 3/30 at 5 pm, and Phase 3 is due on Friday, 4/6 at 5 pm.
 3/22 Since we have Exam 2 coming up and Project 1 due in the next
few days, there will no assigned homework this week. Also there will be no
quiz in the discussion section on Tuesday, 3/27. The TAs will do an exam review.
 3/22 All about Exam 2.
 3/21 Tentative midsemester letter grades.
 3/19 Exam 2 is scheduled for 3/28, 6:308:30 pm. More details will be available shortly.
 3/19 One of our TAs, Dan Squires will be out of town this week for a conference. His office hours for the week are canceled. There will be a
"substitute" instructor for each of his discussion sections.
 3/19 There was an error in HW6, Problem 4 that has been fixed. 0**0 evaluates to 1 and not 0, as orginally mentioned.
 3/4 Here is some information on testing your solutions to Homework 5; and here are the actual test files:
gradeDistributionTest.py (Problem 1), areCollinearTest.py (Problem 2),
collinearityTestTest.py (Problem 3).
 3/1 Attend the 2012 University of Iowa Computing Conference this weekend (3/2 and 3/3). As an extra incentive Homework 5 contains extra credit that you can get by
attending.
 2/19 Exam 1 Review during Discussion Section, Tuesday, 2/21.
 2/19 Practice Exam. This was Exam 1 from Spring 11. You can go to the Spring 11 webpage
for solutions.
 2/15 All about Exam 1.
 2/13 Since Exam 1 is coming up, we'll take a break from homeworks. Homework 4 will be posted on 2/22.
 2/13 Prof. Steve Miller (who teaches the evening section) has a new office. This is in 201K MacLean Hall.
 2/6 The last line of the pseudocode in Problem 6, HW 2 has a typo. The word "remainder" should be changed to "divisor."
 1/30 Mark your calendars! Exam 1 will be on Wednesday, 2/22 from 6:308:30 pm. Exam 2 will be on Wednesday, 3/28 from
6:308:30 pm. More details when we get closer to the exam dates.
 1/30 Evening section Quiz 2 will take place on Wednesday, 2/1.
 1/30 Main section Quiz 2 will take place during discussion sections on Tuesday, 1/31.
 1/30 Homework 2 will be posted on 2/1 and will be due back on 2/8.
 1/23 Prof. Pemmaraju's office hours: Mondays 1pm2:30 pm, Fridays 2pm3:30 pm.
 1/17 Homework 1 will be posted by 1/25 (Wednesday) and will be due back on 2/1.
 1/17 Main section: Discussion sections have their first meeting on 1/24 (Tuesday). Make sure you know your discussion section.
You will take Quiz 1 during your discussion sections. The TAs will walk you through how to write Python programs using the Wing IDE.
 1/17 Evening section: Quiz 1 will be on 1/25 (Wednesday).

Week 15: 4/234/27

Week 14: 4/234/27

Week 13: 4/164/20
Implementing "divideandconquer" using recursion: binary search, merge sort, and quick sort.

Week 12: 4/94/13
Exception handling in Python, recursion and recursive functions.
 Lecture on 4/9.
 Quiz 9 on Tuesday, 4/10 will consist of 2 problems on dictionaries.
One problem will involve evaluating expressions that modify dictionaries and the second
will involve writing or completing a function on dictionaries.
You should study the playGame program that we have been writing.
 Lecture on 4/11, fibonacci.py.
 Lecture on 4/13, power.py.
Week 11: 4/24/6
Tuples and dictionaries in Python, example of using dictionaries as sets in network exploration.
 Lecture on 4/2.
 Quiz 8 on Tuesday, 4/3 will consist of 2 problems
that will focus on the new "inplace" list modification operations
we have studied such as insert, append, remove,
pop, etc. One problem will require that you evaluate Python
code that uses these operations and the other problem will require you
to write a small function involving these operations.
 Lecture on 4/4. playGame1.py: program that plays the "word ladders" game using words from
the file words.dat.
 Lecture on 6/4. playGame2.py, playGame3.py.

Week 10: 3/263/30
More on operations for list mutation, efficiency of different list operations.
 Exam 2 is on Wednesday, 3/28 from 6:30 pm to 8:30 pm. See
this for more details.
 We will meet at class time (9:30 to 10:20) and I'll answer any questions
you bring; I will not cover any new material.
 There is no quiz in the discussion sections this week; the TAs will do
an exam review.
 Lecture on 3/30.
Week 9: 3/193/23
String operations, File I/O, operations for list mutation.

Week 8: 3/53/9
Functional programming in Python: map, filter, and reduce functions; a sample of string functions; functions that
modify lists.
 Quiz 6 will consist of two problems. Problem 1 will involve evaluating expressions that contain indexing and slicing of
lists and strings. Problem 2 will require you to complete a function involving lists and strings.
 On 3/5 I finished up the lecture from 2/29 and wrote the selectionSort.py program.
 Lecture on 3/7.
 Reading:
Chapter 11 on slice, split, and join and
Chapter 12 on lists from Prof. Ted Herman's notes for 22C:16.

Week 7: 2/273/2
Sequence types: the in operator, the range function, forloops, indexing into
a list, slicing.

Week 6: 2/202/24
More on defining functions and using them; keyword parameters and keyword arguments;
scope of function parameters and local variables; global variables.
Week 5: 2/132/17
Nested loops; the need for organizing code into functions; examples of userdefined functions;
what is a function call and what happens when a function is called; an example involving random walks.
Week 4: 2/62/10
A more indepth look at numeric data types, variables, expressions, builtin functions, and modules.
 Quiz 3 consists of two problems. Problem 1 requires that you evaluate expressions involving int, long, and float objects mixed in with
functions from the math module. For this problem make sure you know what sys.maxint means, though you don't have to memore
the value of this number. Problem 2 will further test your understanding of whileloops, ifstatements, etc.
To prepare for the quiz, read through lecture notes from Week 3 and Monday (2/6). Also, work through the practice problems from Week 3.
 Lecture on 2/6.
 Lecture on 2/8.
 Lecture on 2/10.
 Reading: Chapter 6
from Prof. Ted Herman's notes for 22C:16. Prof. Herman and I have been alternating teaching 22C:16 lately. Prof. Herman
has developed a comprehensive set of notes for this course.
 Practice Problems: Solve these to practice evaluating Python
expressions.

Week 3: 1/302/3
Developing several versions of the primality testing program; the break statement; boolean variables
and boolean operators; commenting and documenting Python code; the math module; timing Python programs;
a more indepth look at numeric data types.

Week 2: 1/231/27
Understanding the Python program that converts nonnegative decimal integers into equivalent binary representation;
a whirlwind tour of constants, variables, operators, expressions, data types, builtin functions, input statements,
output statements, and whileloops in Python; the second programming problem: testing if a given number is a prime.
 Quiz 1 consists of two problems: (i) will involve answering questions about how a program similar to the first programming
problem works and (ii) will involve figuring out the value and type of Python expressions.
 Lecture on 1/23, Python Shell from class on 1/23.
 Lecture on 1/25, intToBinary1.py, intToBinary2.py, intToBinary3.py.
 Lecture on 1/27, intToBinary4.py.
 Practice Problems: Here is a "practice" problem set I posted in Spring 2011. The problems in this set correspond roughly to the material
covered by the end of Week 2. Here is another "practice" problem set. This was Homework 2 from my Spring 2011 offering of 22C:16.
 Reading: Chapters titled "Hello, World," "Who Goes There?,"
"Count to 10," "Decisions," and "Debugging" from this NonProgrammer's Tutorial for Python 2.6.

Week 1: 1/171/20
Welcome to Computer Science I; the excitement of Computer Science; our first programming problem: converting nonnegative
integers into equivalent binary representation; designing an algorithm to solve this problem; translating this algorithm
into a Python program.