Quite a few people did poorly on quiz 4. There will be a retry of quiz 4 on Monday, April 25.
This is a computer programming course using Java. See the syllabus for details.
MW10:30-11:45 and MW 2:00-3:15.
Lab assistants are available during certain hours for assistance. See the following pages. (These pages might not be up to date yet.)
[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.
[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.
[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.
[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.
[1/19/05] We continued looking at loops, including issues on how to define loops. We discussed do loops and for loops.
[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.
[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.
[1/26/05] We continued to look at material from Chapter 4. We discussed objects, instance methods, instance variables and object creation.
[1/28/05] We did another example of a class, looking at the Species (SpeciesFirstTry, SpeciesSecondTry and SpeciesThirdTry) classes from Chapter 4.
[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.
[2/2/05] We did more examples of recursion, including the Towers of Hanoi puzzle.
[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.
[2/7/05] Quiz 1. We had the quiz and went over it.
[2/9/05] Having seen the results of the quiz, we began to review the fundamentals of Java. Please see the notes.
[2/11/05] We continued reviewing Java. We discussed loops and control.
[2/14/05] We continued reviewing Java, including static methods and recursion.
[2/16/05] We continued reviewing Java, and began looking at arrays. We did a simple sorting algorithm that is called insertion sort.
[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.
[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).
[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.