Sections

Each week, you will complete problem(s) to submit at the start of section. Most weeks there will 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. (These points become part of your homework grade; each weekly homework assignment is worth 40 points, so all of the section points for the quarter combine to equal roughly half the weight of one homework assignment.)

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 20: Final review (Thu Mar 14)

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.15 (p675): 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 (p1028): Draw the binary search tree...
  3. Self-Chech 17.22 (p1028): What is the x = change(x)...

Section 19: Inheritance and Polymorphism (Tue Mar 11)

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 9.3 (p616): Consider the following classes: ... Which of the following are legal statements? (Consider all of (a) - (f).)
  2. Self-Check 9.14 (p622): Suppose that the following variables referring to the classes from the previous problem are declared: ... Which of the following statements produce compiler errors? For the statements that do not produce errors, what is the output of each statement? (Answer for all five lines of code shown. You'll need to look at the Bay / Pond / Ocean / Lake classes declared on the previous page.)

Section 18: 2D Arrays / Sudoku (Thu Mar 7)

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 7.28 (p495): Write a piece of code that constructs a two-dimensional array of ...
  2. Self-Check 12.16 (p768): The Fibonacci sequence is a sequence of numbers in which... (write the appropriate client method and helper)

Section 17: Advanced Lists (Tue Mar 5)

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 9.21 (p622): What's wrong with the code for the following interface? (Explain what is wrong in 1-2 sentences, then show the code for a corrected version of the interface.)
  2. Self-Check 15.21 (p925): What changes need to be made to the indexOf method...

Section 15: Binary Trees (Tue Feb 26)

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 17.3 (p1025): How many levels... (solve all of (a) - (e).)
  2. Self-Check 17.5 (p1026): Write the elements of the given tree in the order in which they would be seen by a pre-order, in-order, and post-order traversal.

Section 14: Recursive Backtracking (Thu Feb 21)

Problems: Solve the following one (1) problem on paper (hand-written or printed) and bring your sheet of paper to either one of the sections this week:

  1. (not from textbook): Modify the permute code from Wed's lecture so that it outputs the permutations in the opposite order. That is, instead of permute("JANE") outputting JANE, JAEN, JNAE, ..., it should output ENAJ, ENJA, EANJ, ... Reverse the order by modifying the algorithm and the order in which it chooses various paths to explore, not by literally reversing strings as they are about to be printed. Use the Permutations.java file from the Lectures page as a starting point.

Section 13: Recursive backtracking (Tue Feb 19)

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

  1. In last Wednesday's lecture examples (see Dice.java), why did we need to use a private helper method? Explain in a sentence or two.
  2. What is pruning in the context of recursive backtracking? Why is it worth doing?

Section 12: Midterm Review (Thu Feb 14)

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.6 (p766): Convert the following iterative method into a recursive method: ...
  2. Self-Check 11.9 (p711): Write the countDuplicates method described in Self-Check 11.4, and make it so that it can accept either type of list as a parameter as explained in Self-Check 11.9.

Section 11: 2D Arrays and TA's choice (section problems on searching/sorting) (Tue Feb 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 13.10 (p818): What indexes will be examined as the middle element...
  2. Self-Check 13.12 (p818): How many calls on the mergeSort...
  3. Self-Check 13.13 (p818): Show the state of the elements ... / Show a trace ... (solve both (a) and (b).)

Section 10: Comparable (Thu Feb 7)

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 10.16 (p675): Indicate whether the result of each of the following comparisons ... (solve all of (a) - (f). You do not need to show your work.)
  2. Exercise 10.18 (p677): Modify the TimeSpan class from Chapter 8 ... (You can use the following file as a template: TimeSpan.java)

Section 5: Linked nodes (Tue Jan 22)

Problems: Solve the following one (1) problem on paper (hand-written or printed) and bring your sheet of paper to your section:

  1. Self-Check 16.6 (p975): Draw a picture of what the given linked nodes would look like after the given code executes.
    list.next = new LinkNode(3, list.next);

Section 3: Style and complexity (Tue Jan 15)

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 4.25 (p295): One of the exercises... (ONLY write the method comment, header and exception-throwing code.)
  2. Self-Check 13.7 (p817): Why does the binary search ... (One sentence is fine.)
  3. Self-Check 13.8 (p817): How many elements (at most) does a binary search examine ... (Give a number as your answer and briefly explain why you chose that answer in one or two sentences.)