Sections

Each week you will complete problem(s) to turn in at your section. Most weeks there will usually be problems posted for both Tuesday's and Thursday's section. You must complete at least one problem set per week to earn +3 points for that week. You must earn a total of 20 points for the quarter to receive full credit. Additional points beyond these 20 do not affect your grade, but you are welcome to complete every set of problems if you like.

You will not be graded on whether you have a perfect solution, but on whether you have demonstrated effort. Therefore please show some work that demonstrates how you got the answer rather than just writing the answer by itself. We will be somewhat lenient about exactly how the work is shown. If you find that you have been working on these problems for more than 30 minutes, please stop and indicate this on your paper. Incomplete solutions can still receive credit.

Section homework will be made available the day before it is due. Since it is meant as a warm-up for section, we encourage you to do it not too long before section.

Section 20: Final review (Thu Mar 12)

Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:

  1. Self-Check 10.20 (10.15 2nd E.) p696 (p675 2nd E.): What is natural ordering? How do you define a natural ordering for a class you've written? (write 2-3 sentences)
  2. Self-Check 17.20 p1050 (p1028 2nd E.): Draw the binary search tree that would result if the given elements were added to an empty binary search tree in the given order: Lisa, Bart, Marge, Homer, Maggie, Flanders, Smithers, Milhouse
  3. Self-Chech 17.22 p1050 (p1028 2nd E.): What is the x = change(x) pattern, and how is it used with binary trees?

Section 11: Midterm Review (Tue Feb 10)

Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:

  1. Self-Check 12.7 (12.6 2nd E.) p804 (p766 2nd E.): Convert the following iterative method into a recursive method:
        // Prints each character of the string reversed twice.
        // doubleReverse("hello") prints oolllleehh
        public static void doubleReverse(String s) {
            for (int i = s.length() - 1; i >= 0; i--) {
                System.out.print(s.charAt(i));
                System.out.print(s.charAt(i));
            }
        }
    
  2. Complete the following Practice-It problem. Write the code necessary to convert the following sequences of ListNode objects:
        front  -> [1] -> [2] /
        temp -> [3] -> [4] -> [5] /
    
    Into this sequence of ListNode objects:
    
        front  -> [3] -> [2] -> [4] -> [1] -> [5] /
    
    There may be more than one way to write the code, but you are NOT allowed to change any existing node's data field value. You also should not create new ListNode objects unless necessary to add new values to the chain, but you may create a single ListNode variable to refer to any existing node if you like. If a variable does not appear in the "after" picture, it doesn't matter what value it has after the changes are made.