Pitt Logo SIS Logo

Department of Information Science and Telecommunications

 

INFSCI 0012 - Introduction to Programming

(Fall 2002, CRN 43749)


[ Formal Data | Course Tools | Syllabus | Course Books | Course Schedule | Course Materials | CourseWeb | KnowledgeTree | Links ]


Course Materials

Lecture Objectives Readings Handouts Examples
Lecture 1
Introduction
Introduction to the course. Logistics. Karel the Robot. Karel World Pattis:
Introduction; Chapter 1
Tutorial:
Lessons 1 and 2
Slides  
Lecture 2
Programming
Programming and programs. First Karel program. Karel basic commands. Compilation and errors. Pattis:
Chapter 2 (with exercises)
Tutorial:
Lessons 3 and 4
Slides

jail.kp
jail.kw
movebeeper.kp
movebeeper.kw

Lecture 3
New instructions
Defining new instructions. Block. Programs with new instructions. Pattis:
Chapter 3, Sections 3.1 - 3.7
Tutorial:
Lesson 10 (first half)
Slides

around.kp
upstairs.kp
upstairs.kw
stairsweep.kp
stairsweep.kw

Lecture 4
Program design
Programming as problem solving. Stepwise refinement. Design Tree. Pattis:
Chapter 3, Sections 3.8 - 3.10
Slides

harvest.kp
harvest.kw

Lecture 5
Conditional Execution
Conditions. If-then instruction. If-else instruction. Pattis:
Chapter 4, Sections 4.1 - 4.5
Tutorial:
Lessons 6, 7, 9
Slides

cleanerstairs.kp
cleanerstairs1.kw
cleanerstairs2.kw
cleanerstairs3.kw
badyearharvest.kp
badyearharvest.kw
hurdle.kp
hurdle.kw

Lecture 6
Loops
Iterate loop. While loop. Pattis:
Chapter 4, Sections 4.8
Chapter 5, Sections 5.1-5.3
Tutorial:
Lessons 8, 11
Slides

plantsquare.kp
plantsquare.kw
cleanerstairs2.kp
cleanerstairs2.kw
carpet2.kp
carpet2.kw
anycarpet.kp
anycarpet.kw
race2beeper.kp
race2beeper.kw

Lecture 7
Nested if and while
Explicit and implicit nested while. else-if construct. Checking complex conditions Pattis:
Chapter 4, Sections 4.5-4.7, 4.9
Chapter 5, Sections 5.4-5.6
Slides

harvestwhile.kp
harvestwhile.kw
richharvest.kp
richharvest.kw

Lecture 8
Advanced programming with Karel
if inside while. Recursion Pattis:
Chapter 5, Sections 5.7-5.8
Chapter 6, Sections 6.1
Slides

beeperincell.kp
beeperincell.kw
oddharvest.kp
oddharvest.kw
findbeeperrec.kp
findbeeperrec.kw
lostbeepermine.kp
lostbeepermine.kw
movebeepers.kp
movebeepers.kw

Lecture 9
Introduction to C
C logistics. First C program. C tools, compilation and errors Perry:
Chapter 1; Chapter 2 (until "Kinds of Data"); Chapter 3 (first run)
Slides

HelloWorld.c

Lecture 10
Data Types and Expressions
C Data Types. Arithmetic operations. Using printf. Print formatting specifications. Perry:
Chapter 2 (starting from "Kinds of Data"); Chapter 4; Chapter 9 (first run)
Slides

printing.c
printing1.c
printing2.c
calculating1.c
calculating2.c

Lecture 11
Variables
Variables. Declaration and initialization. Assignment. Numeric data types. Implicit type conversion. Program readability. Comments. Program design. Perry:
Chapter 3; Chapter 5; Chapter 9
Slides

exchange_kiosk.c
variables.c

Lecture 12
Simple Programs
Defined constants. Preprocessor. Input. Simple programs with input. Perry:
Chapter 7; Chapter 8
Slides

better_kiosk.c
capital.c

Lecture 13
Simple Loops
Expressions. Statements. Block. While loop. Increment and decrement. Compound assignmenmts (+=; -=; *=; /=, %=). Perry:
Chapter 10; Chapter 14 (first run)
Slides

countdown1.c
countdown2.c
capitalyears.c

Lecture 14
Loops and tables
Relational operators (< > <= >= != ==); Programming patterns. Printing tables with while loop; Counter-controlled and sentinel-controlled loops. Summing up an input. while loop vs. until loop; After this lecture you should get a good understanding of basic loops and be able to write simple programs with counter-controlled and sentinel-controlled loops, in particular, programs that process and print tables Perry:
Chapter 11: Testing data; Chapter 14
Slides

f2c_table.c
nicer_f2c_table.c
accumulator.c
apples_kids.c
capitaltable.c

Lecture 15
Character Processing
Char data type. Typecasting. Char input and output. Filter programs. If and if-else control structures Perry:
Chapter 10: Typecasting; Chapter 11: Testing data; Chapter 18.
Slides

char_codes.c
count_char.c
copycat.c

Lecture 16
Conditionals
Use of if and if-else. Nested Ifs, ifs inside loops. Conditional operator. Perry:
Chapter 11; Chapter 13: Hello Conditional
Slides

max2.c
max1.c
rate2.c
max3.c
maxloop.c
line_count.c

Lecture 17
Complex Conditions
Else-if construct. Logical operators. Programs with complex conditions. Perry:
Chapter 12
Slides

qpa.c
rate3.c
encrypt.c
wc.c

Lecture 18
For and Switch
For loop. For vs. while. Switch. Switch vs. else-if. Perry:
Chapter 15; Chapter 17
Slides

av_line_while.c
av_line_for.c
f2c_for.c
wc.c
vowels.c
vowels_switch.c

Lecture 19
Arrays
Arrays. Array input and output. Array processing with for. Perry:
Chapters 20 to 22
Slides arrayio.c
arrayiofor.c
arraysum.c
arraymax.c
arraymin.c
digcount.c
Lecture 20
Functions
Functions. Parameter passing by value. Function prototypes. Perry:
Chapter 30; First reading of to Chapters 31 and 32
Slides babyweighting.c
power.c
Lecture 21
Character Arrays
Character arrays, strings, processing, initializing, and printing strings. Prameter passing by value and by refernce. Perry:
Chapters 6, 31, 32
Slides parampass.c
insummax.c
palindrome.c
str2int.c
Lecture 22
Nested Loops
Nested loops, bar charts, string search. Reading and processing standard input line by line. Perry: Chapter 19, Chapter 22
Slides starchart.c
longestline.c
patternsearch.c
Lecture 23
Pointers
Memory and variables. Pointers. Operations with pointers. Pointers and functions. Pointers and arrays. Address Arithmetic. Pointers and char arrays. Perry: Chapter 24. Chapter 25 (First reading)
Ted Jensen:
Pointers and Arrays in C: Chapters 1-4
Stanford CS Ed. Library:
Pointers and Memory
Slides goodswap.c
strcomp.c
Lecture 24
Two-Dimensional Arrays
Two-Dimensional Arrays. Arrays of Pointers. Perry: Chapter 25. Chapter 26
Ted Jensen:
Pointers and Arrays in C: Chapters 6-9
Slides navalbattle.c
yearday.c
printback.c
betterbattle.c
Lecture 25
Recursion
Recursive defintions, Recursive functions. Implementation of recursion. Perry:
Slides
recfactorial.c
recpower.c

Copyright © 2002 Peter Brusilovsky