Spring 2014: 22c:016 Computer Science I: Fundamentals (Discussion)

Course Supervisor: Professor Sriram Pemmaraju

Discussion Sections: Tue 8:30A - 9:20A (Section A01) at 110 MLH & Tue 5:00P - 5:50P (Section A06) at 118 MH

Office Hours: Thu 3:30P - 6:30P at 301 MLH and by appointment

Links: Course page by Professor Pemmaraju

Announcements

HW1 submissions with wrong filename (posted on 3/01): As stated in the homework description, no credit is given to homework 1 programs submitted with an incorrect filename. However, students may receive partial credit for those submissions (only applicable for HW 1) by meeting their TA.

Discussion summaries, examples and files (by week)

Week 1: No discussion.

Week 2 (1/28): We discussed the solutions of practice problem set 1, especially problem 2 (Euclid's algorithm to compute GCD of two numbers) and problem 3 (ternary number system). We also had some practice on evaluating expressions and specifying their types. We used type() function in Python shell to verify some of our works. Finally students took their quiz 1.

Week 3 (2/4): We solved problem 1 from a previous year homework. Our main focus was to illustrate the use of while and if-else statements in python. To understand the syntax more clearly, we also solved problem 3 and 5 from previous year practice problem set 2. Then students took their quiz 2.

Example program: hotpo.py

Week 4 (2/11): We closely looked at some python programs and analyzed them in detail. We solved problems 4, 6 and 8 from practice problem set 3. We also discussed a couple of homework problems before students took their quiz 3.

Week 5 (2/18): We discussed the algorithm for problem c from homework 2 and practiced on expression evaluations from a spring 2012 problem set. We also solved problem 4 from here before the quiz 4 took place in class.

Week 6 (2/25): Exam 1 was returned in class and we solved problems 2(c), 3(b) and 4 from the exam. Then we solved first 4 problems from a spring 2013 practice set. These problems involve the use of Python lists and functions. There was no quiz in this week.

Example programs: 

exam1_prob_4.py   week_6_Prob1.py  week_6_Prob2.py  week_6_Prob3.py   week_6_Prob4.py

Week 7 (3/4): We went over the details of homework 3 and solved problems chosen by students from practice problem set 5. Students took their quiz 5 at the end.

Example programs: week7.py

Week 8 (3/11): Based on the questions received on email and in office hours, we first spent some time on discussing homework 3 problems. Then we went through few examples to demonstrate some of the common Python list operations (e.g. expand(), append(), insert() etc.). Finally, before students took their quiz 6, we solved a problem in Python that involves list operations. The problem is about "rotating" a list, find full description in week8.py. Several different solutions of this problem (not discussed in class) are also included to show various Python syntaxes related to lists.

Example programs: week8.py

Spring break (3/16 to 3/23): No discussion.

Week 9 (3/25): We talked about data structure creation part of project 1 Phase 1, solved some problems from practice problem set 7, and had quiz 7 at the end.

Week 10 (4/1): We went through few problems from practice problem set 8, and solved some other problems (given as example programs) to practice more list comprehensions. Students took quiz 8 at the end of the class.

Example programs: week10.py

Week 11 (4/8): Exam 2 was returned in class and we discussed problem 3(a), 3(b) and 4 from exam. We talked about basic structure of a kml file, and worked to generate a kml file using Python programming. The example program generates a KML file that marks all the cities that had a population larger than a specified parameter. It also constructs a network (graph) of cities where any pair of cities are connected by a line segment if the distance between them was less than 500 miles. A screenshot of the visualization by Google earth is given below.

Example program: KML_example.py    A sample kml file

Week 12 (4/15): We went over few problems from practice problem set 9, and had quiz 9 in class.

Week 13 (4/22): We started our discussion with a review of the project 2 handout. Then we went over problems 1 and 2 from practice problem set 10, and had quiz 10 in class. My solution for problem 5 (not covered in class) from practice set 10 is posted below as the example program.

Example program: makeLaddersGame.py

Week 14 (4/29): We briefly discussed some basics of recursive functions, and wrote solution for problem 4 and 5 from practice problem set 11. The program I wrote in the morning (8:30AM) section was slightly incorrect, the corrected code is posted as the example program. Then we worked on problem 1 and 3 from the same practice set, and had quiz 11 at the end.

Example program: week14.py

Week 15 (5/6): We solved a couple of problems related to quick sort from practice problem set 12. Students took quiz 12 in class.