Each week you will complete problem(s) to turn in at your 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 +2 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.
Problems: Solve the following one (1) problem on paper (hand-written or printed) and bring your sheet of paper to your section:
Problems: Solve the following one (1) problem on paper (hand-written or printed) and bring your sheet of paper to your section:
Problems: Solve the following one (1) problem on paper (hand-written or printed) and bring your sheet of paper to your section:
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
Problems: Solve the following one (1) problem on paper (hand-written or printed) and bring your sheet of paper to your section:
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:
permute
code from Mon/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.
Set
the way our code is written. (Just describe in a few sentences what you would do; you don't need to turn in any code.)
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
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.
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
{key1=value1, key2=value2, ...}
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
Problems: Solve the following one (1) problem on paper (hand-written or printed) and bring your sheet of paper to your section:
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.
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
set
that ... (You can base your solution on the get
method we wrote in lecture on Wednesday. If you're having trouble, do the best that you can in < 30 minutes and turn in your best effort.)
Problems: Solve the following one (1) problem on paper (hand-written or printed) and bring your sheet of paper to your section:
list.next = new LinkNode(3, list.next);
Problems: Solve the following two (2) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
ArrayList
can already do all the things they do and more?
Stack
named s
that contains various integer values:
Stack<Integer> s = new Stack<Integer>(); s.add(...); ...Write a piece of code that looks through the entire stack to find all occurrences of the value
42
and prints out this count to the console. If you like, you can put your code in a method named count
that accepts the stack and the value to search for as parameters, but this is not required.
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
Problems: Solve the following three (3) problems on paper (hand-written or printed) and bring your sheet of paper to your section:
ArrayIntList
where the size is never incremented when add
is called. Write a minimal JUnit test method that would expose this bug. (In other words, the test would fail if we have this bug, but pass if we do not.)
You do not have to write a complete test class, or any import
statements, etc.; and you don't actually need to set up JUnit on your computer yet or run your test method if you don't want to. Just write out the code for this one method manually. It can be very short; write the minimal amount of code you need so that this bug will make an assertion fail.
You don't need to write a complete program; just the relevant lines of code to answer the question.
ArrayIntList
(Tue Jan 11)
Problems: Solve the following two (2) Self-Check problems on paper (hand-written or printed) and bring your sheet of paper to your section:
You don't need to write a complete program; just the relevant lines of code to answer the question.
ArrayList
(Thu Jan 6)
Problems: Solve the following three (3) Self-Check problems on paper (hand-written or printed) and bring your sheet of paper to your section:
ArrayList
containing these elements. ...
ArrayList
holding ...
You don't need to write a complete program; just the relevant lines of code to answer the question.
No problems are due for the first section.