CSCI 2310/2311
Spring 2005

Last modified 4/24/05

Announcements

Quite a few people did poorly on quiz 4. There will be a retry of quiz 4 on Monday, April 25.


Syllabus

This is a computer programming course using Java. See the syllabus for details.


Office hours

MW10:30-11:45 and MW 2:00-3:15.


Lab and help hours

Lab assistants are available during certain hours for assistance. See the following pages. (These pages might not be up to date yet.)


Notes


Assignments

  1. Programming assignment 1
  2. Programming assignment 2
  3. Programming assignment 3
  4. Programming assignment 4
  5. Programming assignment 5
  6. Programming assignment 6
  7. Programming assignment 7
  8. Programming assignment 8
  9. Programming assignment 9
  10. Programming assignment 10


Self-test exercises

  1. Practice questions for quiz 1
  2. Solutions to practice questions for quiz 1
  3. Practice questions for quiz 2
  4. Solutions to practice questions for quiz 2
  5. Practice questions for quiz 3
  6. Solutions to practice questions for quiz 3
  7. Practice questions for quiz 4
  8. Solutions to practice questions for quiz 4


Lecture summaries

  1. [1/7/05] We went over the syllabus and the course objectives. We discussed grading of programming assignments. Then we started on the basics of Java, covering variables, assignments, elementary expressions and primitive types. This material is in Chapter 2.

  2. [1/10/05] We covered more on Java expressions from Chapter 2. We discussed strings and operations on strings; the main program; input; and output. The text describes Java 1.5, but our compiler uses Java 1.4. The Scanner class is part of Java 1.5, so we will use a different form of input.

  3. [1/12/05] We finished expressions and began looking at material on flow of control from Chapter 3. We discussed if-statements, including how to lay them out, and did some examples with if-statements. We discussed boolean expressions.

  4. [1/14/05] We continued with Chapter 3. We looked at switch statements and began looking at loops. The simplest and most common kind of loop is the while loop.

  5. [1/17/05] Holiday.

  6. [1/19/05] We continued looking at loops, including issues on how to define loops. We discussed do loops and for loops.

  7. [1/21/05] We began looking at Chapter 4. We introduced (static) methods, including parameters and return values, and did some examples. We discussed contracts, which tell what a method does, and implementations, which tell how a method works. Methods are also commonly called functions.

  8. [1/24/05] We introduced breaks for loops, and did another example of a static method. We looked briefly at void methods, which do a job but do not return a value.

  9. [1/26/05] We continued to look at material from Chapter 4. We discussed objects, instance methods, instance variables and object creation.

  10. [1/28/05] We did another example of a class, looking at the Species (SpeciesFirstTry, SpeciesSecondTry and SpeciesThirdTry) classes from Chapter 4.

  11. [1/31/05] We will take a break from looking at classes to explore another control mechanism, recursion. This is covered in Chapter 11 of the text. (If you look at the preface, you will see that you do not need to know everything in the first 10 chapters to make sense out of the beginning of Chapter 11. We will be looking only at the beginning of Chapter 11 here.)

    The book takes a viewpoint of looking in detail at the mechanism of recursion, where you see the entire process of the computation. That is good to know, but the whole point of recursion is to avoid looking at the whole process. That is where recursion gets its strength. You can understand a difficult computation in simple pieces, and never need to see the whole process at once. We will concentrate on the right way to think about recursion.

  12. [2/2/05] We did more examples of recursion, including the Towers of Hanoi puzzle.

  13. [2/4/05] We began to look at arrays, including how to create an array and indexing into an array. This material is in Chapter 6 of the text.

  14. [2/7/05] Quiz 1. We had the quiz and went over it.

  15. [2/9/05] Having seen the results of the quiz, we began to review the fundamentals of Java. Please see the notes.

  16. [2/11/05] We continued reviewing Java. We discussed loops and control.

  17. [2/14/05] We continued reviewing Java, including static methods and recursion.

  18. [2/16/05] We continued reviewing Java, and began looking at arrays. We did a simple sorting algorithm that is called insertion sort.

  19. [2/18/05] We looked at elementary algorithms on arrays, including comparing two arrays to see whether they hold the same values, and searching an array for a particular value.

  20. [2/21/05] We looked at searching arrays using linear search and binary search. We did a simple analysis of both algorithms. On an array of size n, linear search takes time proportional to n, but binary search takes time proportional to log2(n).

  21. [2/23/05] We looked at the problem of sorting an array. We developed an interative (looping) version of insertion sort, and found that it does approximately n2 swaps in the worst case to sort an array of size n.