CS170 - Syllabus and Lecture Notes

  1. Introduction to the computer

    1. Introduction to programmable computing devices: click here        ------   PPT
    2. Overview of the computer: storing/encoding instructions and information click here        ------   PPT
    3. The computer memory and the binary number system: click here        ------   PPT
    4. Introduction to the computer - how a computer executes instructions click here        ------   PPT

    5. Introduction to computer algorithms: click here        ------   PPT
       Assign homework 1 
    6. Programming a computer: click here        ------   PPT

  2. Using and interacting with computers (---- this material is taught in lab sessions)

    1. Using and Interacting with a computer in general: click here        ------   PPT
    2. Using and Interacting with a UNIX computer in the MathCS lab:
      1. Listing the content of a directory: click here        ------   PPT
      2. Navigating the UNIX directory structure: click here        ------   PPT
      3. Manipulating files: click here        ------   PPT
      4. Editing files with gedit: click here        ------   PPT

    3. Using the BlueJ Integrated Development Environment (IDE):
      1. Editing Java programs with BlueJ: click here        ------   PPT
      2. Using BlueJ with an existing Java program: click here
      3. Compiling and running Java programs with BlueJ: click here        ------   PPT
      4. Debugging Java programs with BlueJ: click here
      5. External material: A BlueJ Tutorial: click here

  3. Intro to the Java Programming language

    1. Using the (stand-alone) Java programming language compiler: click here        ------   PPT

    2. What does a computer program contain - statements and variables: click here
    3. Executing a computer program: click here

    4. Comparing the organization of a Java program to that of a book: click here
    5. The building blocks of a Java program: click here

  4. Storing and manipulation numerical information

    1. Floating point numerical information: click here
    2. Floating point operators and floating point expressions: click here
    3. Arithmetic expressions containing Mathematical functions: click here

    4. Importing methods in Java's library: click here
    5. Invoking (using) methods in Java's library: click here
    6. Using Java's Scanner class to read input from the console input: click here

    7. Assignment statements using the same variable in LHS and RHS: click here

    8. Different types of numerical information:
      1. Floating point variables of different lengths: click here
      2. Integers:
        1. The integer data types: click here
        2. Reading integer inputs: click here
        3. Integer operators: click here
        4. Examples of Integer arithmetic: click here
        5. Automatic conversions in Integer arithmetic: click here

      3. Summary automatic conversion rules: click here

    9. Mixing integer and floating point numbers in an arithmetic operation: click here
    10. Numerical literals and named constants: click here

    11. Short-hand operators: click here
    12. The assignment expressions: click here
    13. The ++ and -- operators: click here

    14. External reference page on priority and associativity of Java's operators: click here

  5. The character and string data types

    1. The character data type   char: click here
    2. The string data type   String: click here

  6. Conditional statements and Boolean expressions

    1. The if-statement: click here
    2. The Boolean (logical) data type: click here
    3. Boolean expressions, part 1: compare operators click here
    4. Boolean expressions, part 2: logical operators click here

    5. The if-else-statement: click here
    6. More advanced boolean conditions: click here
    7. Comparing floating values on equality (and inequality): click here

    8. Nested conditional statements: click here
    9. Programming example: tax computation click here
    10. The switch statement: an N-way selection statement click here

    11. The dangling-else ambiguity: click here

  7. Loop statements

    1. The while-statement:
      1. Introducing the while-statement: click here
      2. Writing algorithms using the while-statement: click here

      3. Desiging loops: the loop invariant click here

      4. Advanced algorithm - the Bisection Method: click here
      5. Programming errors on using the while-statement: click here

      6. The break and continue statements: click here
      7. Using the while-statement to process data files: click here

    2. The for-statement:
      1. Introducing the for-statement: click here
      2. Writing algorithms using the for-statement: click here
      3. Advanced algorithm - the Rectangle Method: click here
      4. Advanced algorithm - Exact Pattern Matching: click here
      5. A simple Monte Carlo simulation using a for-loop: click here

      6. The break and continue statements inside a for-statement: click here

    3. Nesting loop statements:
      1. Using nested for-loops in simple graphics: click here
      2. Using nested for-loops in parsing: click here

    4. Re-writing the for-statement with a while-statement and vice versa: click here

    5. The do-statement: click here

  8. Methods and variables

    1. Introduction to methods: click here
    2. The different kinds of variables in a Java program: click here
    3. Memory organization - storing variables efficiently in the RAM memory: click here

    4. Local variables:
      1. Local variables and how to recognize them: click here
      2. The life time of local variables: click here
      3. The scope of local variables: click here
      4. An important property of local variables: click here

    5. Parameter variables: click here

    6. The method invocation mechanism and the System stack: click here
    7. How a parameter is passed to a method:
      1. Parameter passing mechanism: pass-by-value : click here
      2. Parameter passing mechanism: pass-by-reference : click here

    8. Class variables: click here

      (Instance variables will be discussed later in Section 10)

  9. The array data structure

    1. Introducing the array data structure:
      1. Introduction and motivation: click here
      2. The basics of the array data structure: click here

      3. Working with arrays (of numbers): click here
      4. Simple algorithms on an array - sum, min: click here

    2. Copying an array in Java:
      1. Copying an array and changing the size of an array: click here
      2. The array doubling algorithm: click here

    3. Array of String:
      1. Array of the type String: click here
      2. The command line arguments: click here
      3. Array of the type char - another way to represent string: click here
      4. Converting String to array of char and vice versa: click here

    4. Storing multiple information on items --- Parallel arrays: click here

    5. Sort an array - the selection sort algorithm: click here

    6. Passing an array as parameter to a method: click here

      1. Making an algorithm more available (i.e., more useful): click here

    7. Returning an array as return value from inside a method: click here

      1. Example returning an array from a method - Sieve of Eratosthenes click here

    8. Arrays of higher dimensions:
      1. 2-dimensional arrays: click here
      2. Using 2-dimensional arrays --- making pictures on a 400x300 grid: click here
      3. (SKIP: (too difficult) Using 2-dimensional arrays --- The Gaussian Elimination Algorithm for simultaneous equations: click here )

  10. Classes: user-defined types

    1. Instance variables:
      1. Instance variables, objects and user-defined types (classes with only variables) --- information on bank account: click here
      2. Life time and scope of Instance variables: click here
      3. Passing an object as a parameter to a method: click here

    2. Instance methods: click here

    3. Shadowing instance variables by local/parameter variables: click here

    4. Computer lingo: what is an object -- click here
    5. Copying an object: click here

    6. Classes with private variables (and public methods): click here

    7. Special features built-in to objects:
      1. User-controlled initialization of objects - Constructor methods: click here
        1. The copy constructor: click here
      2. User-controlled conversion of objects into String representation - toString(): click here

  11. Data Abstraction: hiding details to make programming manageable

    1. Principles of Object Oriented Programming - Information hiding and Abstract Data Types (ADT): click here

    2. Example of Object-Oriented programming (OOP): a deck of playing cards
      1. Implementing playing cards: click here
      2. Using the Card class: click here
      3. Passing a Card object to an instance method of the Card class: click here

      4. Implementing a deck of cards: click here
      5. Using the DeckOfCards class: click here

      6. Decoupling in action: Changing the implementation of the Card object: click here

    3. Using the deck of card: play Poker (5 card stud)
      1. Introduction to the game of Poker: click here
      2. Playing Poker on a computer - a Poker card game method library
        1. Designing the Poker library: click here
        2. Checking for Poker hands: click here
          1. Monte Carlo experiment to find the probabilities of Poker hands: click here
        3. Prepare to play Poker --- Assigning values to Poker hands: click here
          1. Make a Computer play Poker: click here

  12. The String data type

    1. Review of Strings in Java and some: click here
    2. Comparison operations (instance methods) on Strings: click here
    3. Finding substrings (instance methods) in Strings: click here
    4. Some transformation operations (instance methods) on Strings: click here

    5. Converting String to array of char and vice versa: click here

  13. Modular programming: solving complex problems with computer programs

    1. Modular programming and the divide and conquer methodology: click here

    2. A Case study: Text formatting
      1. Problem description: click here

      2. The first step in every computer algorithm: click here

      3. Divide and conquer the text formatting problem: click here
        1. Get one line of text: click here
        2. Format one line of text: click here
        3. Print in 2 columns: click here

  14. Recursion

    1. Intro to Recursion: click here
    2. Computing n! (factorial) using recursion: click here
    3. Computing Fibonacci numbers using recursion: click here
    4. Solving the Tower of Hanoi using recursion: click here
    5. Recursive binary search: click here

  15. Packages

    1. Putting a class into a package: click here
    2. Using classes from a package (in same directory): click here
    3. Using classes from a package in an abitrary directory: click here
    4. The package access specifier: click here

  16. Inheritance: extending (re-using) existing classes (software)

    1. Intro to inheritance: click here
    2. Adding more instance variables and methods to a derived class: click here
    3. Access specifiers and Inheritance: click here

    4. Using constructors in the base class: click here

    5. The type information of variables: click here
    6. Converting between user-defined types: Upcasting and Downcasting click here
    7. Application of upcasting: click here

  17. Summary on the access specifiers in Java: click here