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 may only receive credit for your section homework if you attend section.
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.
June 3 2014 4:30 PM
Section 20: Final review (Thu Jun 5)
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 10.20 (p696): What is natural ordering? How do you define a natural ordering for a class you've written? (write 2-3 sentences)
- Self-Check 17.17 (p1050): Draw the binary search tree...
- Self-Chech 17.22 (p1050): What is the x = change(x)...
June 2 2014 3:30 PM
Section 19: Inheritance and Polymorphism (Tue Jun 3)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 9.4 (p635): Consider the following classes: ... Which of the following are legal statements? (Consider all of (a) - (f).)
- Self-Check 9.17 (p641): 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.)
May 27 2014 4:30 PM
Section 18: 2D Arrays / Sudoku (Thu May 29)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 7.33 (p510): Write a piece of code that constructs a two-dimensional array of ...
- Self-Check 12.19 (p807): The Fibonacci sequence is a sequence of numbers in which... (write the appropriate client method and helper)
May 20 2014 4:30 PM
Section 17: Linked list review (Tue May 27)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 16.18 (p998): What are the two ways to change the contents of a linked list?
- Excercise 16.13 (p1000): Write a method
transferFrom
... (also on Practice-It)
May 20 2014 4:30 PM
Section 16: Binary Trees 2 (Thu May 22)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 17.15 (p1049): Which of the following trees are valid binary search trees? (consider all of (a) - (e).)
- Self-Check 17.20 (p1050): 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, ...
May 19 2014 2:30 PM
Section 15: Binary Trees (Tue May 20)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 17.3 (p1047): How many levels... (solve all of (a) - (e).)
- Self-Check 17.5 (p1048): 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.
May 13 2014 4:30 PM
Section 14: Recursive Backtracking (Thu May 15)
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:
- (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 May 13)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- 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.
- What is pruning in the context of recursive backtracking? Why is it worth doing?
May 6 2014 4:30 PM
Section 12: Midterm Review (Thu May 8)
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Describe your midterm review strategy in a few sentences.
- Self-Check 12.7 (p804): Convert the following iterative method into a recursive method: ...
- Self-Check 11.9 (p733): 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 May 6)
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 13.20 (p863): What indexes will be examined as the middle element...
- Self-Check 13.26 (p864): How many calls on the mergeSort...
- Self-Check 13.27 (p864): Show the state of the elements ... / Show a trace ... (solve both (a) and (b).)
Apr 30 2014 1:30 PM
Section 10: Comparable (Thu May 1)
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 9.22 (p641): What is the...
- Self-Check 10.21 (p696): Indicate whether the result of each of the following comparisons ... (solve all of (a) - (f). You do not need to show your work.)
- Exercise 10.19 (p699): Modify the TimeSpan class from Chapter 8 ... (You can use the following file as a template: TimeSpan.java)
Section 9: Sets and Maps (Tue Apr 29)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 11.10 (p733): A List has every ... (A few sentences will suffice.)
- Self-Check 11.20 (p735): What keys and values are contained ... (write the final contents of the map in the following format; the relative order of the keys doesn't matter.
{key1=value1, key2=value2, ...}
Apr 22 2014 4:30 PM
Section 8: Recursive programming (Thu Apr 24)
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 12.10 (p804): What would be the effect
- Self-Check 12.12 (p805): What are the differences...
- Self-Check 12.17 (p806): The following method has a bug ... (Indicate the bug and explain why it causes the method to fail. Why does your change solve the problem?)
Section 7: Recursion (Tue Apr 22)
Problems: Solve the following two (2) problem on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 12.4 (p803):
mystery1
method. For each of the following calls, indicate the output that is produced by the method: (Solve only parts (a), (b), and (e). Show your work by writing out the series of calls that are made before writing the final output. For example, if mystery1(5) calls mystery1(4), write the sequence of such calls before your answer.)
- Self-Check 12.11 (p805): The following method is an attempt...
Apr 16 2014 1:30 PM
Section 6: Linked lists (Thu Apr 17)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 16.20 (p998): When you add or remove ...
- Exercise 16.1 (p999): Write a method called
set
that ... (You can base your solution on the get
method we wrote in lecture. If you're having trouble, do the best that you can in < 30 minutes and turn in your best effort.)
Apr 11 2014 4:00 PM
Section 5: Linked nodes (Tue Apr 15)
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 16.3 (p997): What value ...
- Self-Check 16.6 (p997): Draw a picture of what the given linked nodes would look like after the given code executes.
list.next = new LinkNode(3, list.next);
- Self-Check 16.19 (p998): An element...
Apr 8 2014 4:00 PM
Section 4: Stacks and queues (Thu Apr 10)
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 14.2 (p. 899): What is a real-world...
- Self-Check 14.12 (p. 899): Stacks and queues have less functionality...
- Self-Check 14.16 (p. 900): Write the output produced...
Apr 7 2014 2:20 PM
Section 3: Style and complexity (Tue Apr 8)
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 4.28 (p304): One of the exercises... (ONLY write the method comment, header and exception-throwing code.)
- Self-Check 13.17 (p863): Why does the binary search ... (One sentence is fine.)
- Self-Check 13.18 (p863): 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.)
Section 2: implementing ArrayIntList
(Thurs Apr 3)
Problems: Solve the following two (2) Self-Check problems on paper (hand-written or printed) and bring your sheet of paper to your section:
- Self-Check 15.7 (p946): An element can be inserted at ...
- Self-Check 15.8 (p946): Write methods called min and max that ... (Write just one of the two methods. Either one is fine. You don't need to write both.)
You don't need to write a complete program; just the relevant lines of code to answer the question.