Pitt Logo SIS Logo

Department of Information Science and Telecommunications

 

INFSCI 0012 - Introduction to Programming

(Fall 2003, CRN 32941)


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


Course Materials

Lecture Objectives Readings Handouts Examples
Lecture 1
Introduction
Introduction to the course. Programming and programs. Karel the Robot. Karel World. First Karel program. Pattis:
Introduction; Chapter 1
Tutorial:
Lessons 1, 2, and 3
Slides

jail.kp
jail.kw

Lecture 2
Simpe Programs
Karel basic commands. Compilation and errors. Defining new instructions. Block. Pattis:
Chapter 2 (with exercises)
Chapter 3, Sections 3.1 - 3.4
Tutorial:
Lessons 4
Slides

movebeeper.kp
movebeeper.kw
around.kp

Lecture 3
Program design
Programs with new instructions. Programming as problem solving. Stepwise refinement. Design Tree. Pattis:
Complete Chapter 3

Slides

upstairs.kp
upstairs.kw
stairsweep.kp
stairsweep.kw
harvest.kp
harvest.kw

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

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

Lecture 5
Loops
Iterate loop. While loop. Embedded loops. Loop invariants. Desinging loops. Pattis:
Chapter 5
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
harvestwhile.kp

harvestwhile.kw

Lecture 6
Advanced programming with Karel
Nested while loop. Loops with conditional statements. Recursion Pattis:
Chapter 5, Sections 5.7-5.8
Chapter 6, Sections 6.1
Slides

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

Lecture 7
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 8
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 9
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 10
Simple Programs
Defined constants. Preprocessor. Input. Simple programs with input. Perry:
Chapter 7; Chapter 8
Slides

better_kiosk.c
capital.c

Lecture 11
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 12
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 13
Conditionals
If and if-else control structures. Nested Ifs, ifs inside loops. Calculating min and max. Conditional operator. Perry:
Chapter 11; Chapter 13: Hello Conditional
Slides

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

Lecture 14
Character Processing
Char data type. Typecasting. Char input and output. Filter programs. Perry:
Chapter 10: Typecasting; Chapter 18.
Slides

char_codes.c
count_char.c
copycat.c
line_count.c

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

qpa.c
rate3.c
encrypt.c

Lecture 16
For and Switch
More examples of complex conditions. Switch. Switch vs. else-if.For loop. For loop vs. while loop. 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 17
Array Processing
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
babyweighting.c
Lecture 18
Functions
Functions. Parameter passing by value. Function prototypes. Perry:
Chapter 30; First reading of to Chapters 31 and 32
Slides

digcount.c
sumarfunc.c
power.c

Lecture19
Arrays and Functions
Prameter passing by value and by refernce. Character arrays, strings, processing, initializing, and printing strings. Perry:
Chapters 6, 31, 32
Slides parampass.c
insummax.c
palindrome.c
Lecture 20
Nested Loops
Nested loops, bar charts, string search. Reading and processing standard input line by line. Perry: Chapter 19, Chapter 22
Slides str2int.c
starchart.c
longestline.c
patternsearch.c
Lecture 21
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 22
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 23
Recursion
Recursive defintions, Recursive functions. Implementation of recursion. Perry:
Slides
recfactorial.c
recpower.c

 

Copyright © 2003 Peter Brusilovsky