CS170 - Syllabus and Lecture Notes
Search the lecture notes:
Course introduction and Overview
Introduction:
webpage
(
Must read material
) ------
PPT
Incentives for studying
Computer Science
:
click here
------
PPT
Introduction to the computer
Introduction to
programmable
computing devices:
click here
------
PPT
Overview of the computer: storing/encoding instructions and information
click here
------
PPT
The computer memory and the binary number system:
click here
------
PPT
Introduction to the computer - how a computer executes instructions
click here
------
PPT
Introduction to
computer algorithms
:
click here
------
PPT
Assign homework 1
Programming a computer:
click here
------
PPT
Using and interacting with computers
(---- this material is taught in lab sessions)
Using and Interacting with a computer in general:
click here
------
PPT
Using and Interacting with a
UNIX
computer in the MathCS lab:
Listing the
content
of a directory:
click here
------
PPT
Navigating the
UNIX directory structure
:
click here
------
PPT
Manipulating
files
:
click here
------
PPT
Editing
files
with
gedit
:
click here
------
PPT
Using the
BlueJ
Integrated Development Environment (IDE):
Editing Java programs with
BlueJ
:
click here
------
PPT
Using
BlueJ
with an
existing
Java program:
click here
Compiling and running Java programs with
BlueJ
:
click here
------
PPT
Debugging
Java programs with
BlueJ
:
click here
External material: A
BlueJ
Tutorial
:
click here
Intro to the
Java
Programming language
Using the (stand-alone)
Java
programming language compiler:
click here
------
PPT
What does a
computer program
contain - statements and variables:
click here
Executing a computer program:
click here
Comparing the organization of a
Java program
to that of a
book
:
click here
The
building blocks
of a
Java program
:
click here
Storing and manipulation
numerical
information
Floating point numerical
information:
click here
Floating point operators and floating point expressions:
click here
Arithmetic expressions containing Mathematical functions:
click here
Importing
methods
in
Java's library
:
click here
Invoking (using)
methods
in
Java's library
:
click here
Using
Java's
Scanner
class
to read input from the console input:
click here
Assignment statements using the same variable in LHS and RHS:
click here
Different types of numerical information:
Floating point variables of
different lengths
:
click here
Integers:
The integer data types:
click here
Reading integer inputs:
click here
Integer operators:
click here
Examples of Integer arithmetic:
click here
Automatic conversions in Integer arithmetic:
click here
Summary automatic conversion rules:
click here
Mixing
integer
and
floating point
numbers in an
arithmetic operation
:
click here
Numerical literals and named constants:
click here
Short-hand operators:
click here
The
assignment
expressions
:
click here
The
++ and --
operators
:
click here
External reference page
on
priority
and
associativity
of
Java's operators
:
click here
The
character
and
string
data types
The
character
data type
char
:
click here
The
string
data type
String
:
click here
Conditional statements and Boolean expressions
The
if-statement
:
click here
The
Boolean
(logical) data type
:
click here
Boolean expressions,
part 1
:
compare operators
click here
Boolean expressions,
part 2
:
logical operators
click here
The
if-else-statement
:
click here
More advanced boolean conditions:
click here
Comparing
floating values
on equality (and inequality):
click here
Nested
conditional statements
:
click here
Programming example
: tax computation
click here
The
switch
statement
: an
N-way
selection statement
click here
The
dangling-else
ambiguity
:
click here
Loop statements
The
while
-statement
:
Introducing the
while
-statement
:
click here
Writing
algorithms
using the
while
-statement
:
click here
Desiging loops: the
loop invariant
click here
Advanced algorithm
- the
Bisection
Method
:
click here
Programming errors on using the
while
-statement
:
click here
The
break
and
continue
statements:
click here
Using the
while
-statement
to
process data files
:
click here
The
for
-statement
:
Introducing the
for
-statement
:
click here
Writing
algorithms
using the
for
-statement
:
click here
Advanced algorithm
- the
Rectangle
Method
:
click here
Advanced algorithm
-
Exact Pattern Matching
:
click here
A simple
Monte Carlo
simulation using a
for-loop
:
click here
The
break
and
continue
statements inside a
for
-statement
:
click here
Nesting
loop statements:
Using
nested for-loops
in simple
graphics
:
click here
Using
nested for-loops
in
parsing
:
click here
Re-writing
the
for
-statement
with a
while
-statement
and vice versa:
click here
The
do
-statement
:
click here
Methods and variables
Introduction to
methods
:
click here
The
different
kinds
of variables
in a Java program:
click here
Memory organization
- storing variables
efficiently
in the
RAM memory
:
click here
Local variables:
Local variables
and how to
recognize
them:
click here
The
life time
of
local variables
:
click here
The
scope
of
local variables
:
click here
An important property of
local variables
:
click here
Parameter variables
:
click here
The
method invocation mechanism
and the
System stack
:
click here
How a parameter is passed to a method:
Parameter passing mechanism:
pass-by-value
:
click here
Parameter passing mechanism:
pass-by-reference
:
click here
Class variables
:
click here
(
Instance variables
will be discussed later in Section 10)
The array data structure
Introducing the array data structure:
Introduction and motivation:
click here
The
basics
of the array data structure:
click here
Working with
arrays (of numbers):
click here
Simple algorithms
on an array - sum, min:
click here
Copying an array in Java:
Copying
an array and
changing the size
of an array:
click here
The
array doubling
algorithm:
click here
Array of
String
:
Array of the type
String
:
click here
The
command line arguments
:
click here
Array of the type
char
- another way to represent string:
click here
Converting
String
to
array of char
and
vice versa
:
click here
Storing multiple information
on items ---
Parallel arrays
:
click here
Sort
an array - the
selection sort
algorithm
:
click here
Passing
an
array
as
parameter
to a method:
click here
Making an algorithm more available (i.e., more useful):
click here
Returning
an
array
as
return value
from inside a method:
click here
Example
returning
an array from a method
- Sieve of Eratosthenes
click here
Arrays of higher dimensions:
2-dimensional arrays:
click here
Using
2-dimensional arrays
--- making pictures on a 400x300 grid:
click here
(
SKIP: (too difficult)
Using
2-dimensional arrays
--- The Gaussian Elimination Algorithm for simultaneous equations:
click here
)
Classes: user-defined types
Instance variables
:
Instance
variables
,
objects
and
user-defined
types
(
classes
with
only
variables
) --- information on bank account:
click here
Life time
and
scope
of
Instance
variables
:
click here
Passing an
object
as a
parameter
to a method:
click here
Instance
methods
:
click here
Shadowing
instance variables by
local/parameter
variables:
click here
Computer lingo
: what
is
an
object
--
click here
Copying
an
object
:
click here
Classes
with
private
variables
(and
public
methods
):
click here
Special features
built-in to objects:
User-controlled
initialization
of objects -
Constructor
methods
:
click here
The
copy
constructor
:
click here
User-controlled
conversion
of objects into
String representation
-
toString()
:
click here
Data Abstraction: hiding details to make programming manageable
Principles of Object Oriented Programming - Information hiding and Abstract Data Types (ADT):
click here
Example of
Object-Oriented programming (OOP)
: a deck of playing cards
Implementing
playing cards
:
click here
Using
the
Card
class
:
click here
Passing a
Card
object to an instance method of the
Card
class
:
click here
Implementing a
deck of cards
:
click here
Using
the
DeckOfCards
class
:
click here
Decoupling in action:
Changing
the
implementation
of the
Card
object
:
click here
Using
the deck of card: play
Poker
(5 card stud)
Introduction to the game of
Poker
:
click here
Playing Poker
on a computer - a
Poker card game
method library
Designing the Poker library:
click here
Checking for Poker hands:
click here
Monte Carlo
experiment to find the
probabilities
of Poker hands:
click here
Prepare to play Poker --- Assigning values to Poker hands:
click here
Make a Computer play Poker:
click here
The
String
data type
Review
of Strings in Java and some:
click here
Comparison operations
(instance methods) on Strings:
click here
Finding substrings
(instance methods) in Strings:
click here
Some
transformation operations
(instance methods) on Strings:
click here
Converting
String
to
array of char
and
vice versa
:
click here
Modular programming: solving complex problems with computer programs
Modular programming
and the
divide and conquer methodology
:
click here
A Case study:
Text formatting
Problem description:
click here
The
first step
in
every
computer algorithm:
click here
Divide and conquer the text formatting problem:
click here
Get
one line
of text:
click here
Format
one line
of text:
click here
Print in 2 columns:
click here
Recursion
Intro
to Recursion:
click here
Computing
n! (factorial)
using recursion:
click here
Computing
Fibonacci numbers
using recursion:
click here
Solving the
Tower of Hanoi
using recursion:
click here
Recursive
binary search
:
click here
Packages
Putting a class into a package:
click here
Using classes from a package (in same directory):
click here
Using classes from a package in an abitrary directory:
click here
The
package access
specifier:
click here
Inheritance: extending (re-using) existing classes (software)
Intro to
inheritance
:
click here
Adding
more
instance
variables
and
methods
to a derived class:
click here
Access specifiers and Inheritance:
click here
Using
constructors
in the
base class
:
click here
The
type information
of variables:
click here
Converting between user-defined types: Upcasting and Downcasting
click here
Application of upcasting:
click here
Summary
on the
access specifiers
in Java:
click here