# INFSCI 0012 - Introduction to Programming

### (Spring 2002, CRN 43348)

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

# Course Materials

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
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
Lecture 4
Program design
Programming as problem solving. Stepwise refinement. Design Tree. Pattis:
Chapter 3, Sections 3.8 - 3.10
Slides
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
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
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
Lecture 8
if inside while. Recursion Pattis:
Chapter 5, Sections 5.7-5.8
Chapter 6, Sections 6.1
Slides
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
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
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
Lecture 12
Simple Programs
Defined constants. Preprocessor. Input. Simple programs with input. Perry:
Chapter 7; Chapter 8
Slides
Lecture 13
Simple Loops
Expressions. Statements. Block. While loop. Increment and decrement. Compound assignmenmts (+=; -=; *=; /=, %=). Perry:
Chapter 10; Chapter 14 (first run)
Slides
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
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
Lecture 16
Conditionals
Use of if and if-else. Nested Ifs, ifs inside loops. Conditional operator. Perry:
Chapter 11; Chapter 13: Hello Conditional
Slides
Lecture 17
Complex Conditions
Else-if construct. Logical operators. Programs with complex conditions. Perry:
Chapter 12
Slides
Lecture 18
For and Switch
For loop. For vs. while. Switch. Switch vs. else-if. Perry:
Chapter 15; Chapter 17
Slides
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
palynrom.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. Working with recursive data structures. Towers of Hanoi. Perry: Slides Example1 Example2 Example3