CS2852
Homework
This is an old version of this course, from Spring 2014. A newer version is avaliable here.
The official HW assignments are made in class, not on this page.
Key
- SC
- A Self-check exercise taken from the text (Koffman & Wolfgang, 2E). SCA.B.C indicates "Exercises for Section A.B", problem C.
- RQ
- A Review exercise taken from the text. RQA.B indicates a problem in the blue "Chapter A Review" section, under the "Review Questions" heading.
- M
- MSOE (instructor) provided problem. MA refers to problem A in the instructor-provided list.
- (opt)
- An optional homework problem.
Week 1 -- Due in class, Week 2, Monday
- RQ1.6
- (opt) RQ1.7
- M1,3
- (opt) M2
Instructor problems
- a. What exception could be thrown for this code?
Dog d = new Animal();
b. Re-write the code to do nothing instead of throwing an exception. - Implement the
ArrayList.remove(int index)
method. - Implement the
ArrayList.remove(Object target)
method. - Implement the
ArrayList.lastIndexOf(Object target)
method. - How is it possible for a method to declare a-non void return type (e.g. double) and not include a return statement? Why might you want to do this?
Week 2
(HW announced in class)
Instructor problems
- Complete each sentence by inserting either "array" or "ArrayList." Write or type the full sentence.
- A/an _______ uses syntax that other objects don't
- A/an _______ can be resized
- A/an _______ uses a property instead of a method for length
- A/an _______ can hold primitive types
- (optional) Add your own!
- Give the Big-O time complexity for T(n) = 8 + 17n + 3n2.
- Implement the
LinkedList.add(int, E)
method. - Implement the
ArrayList::ArrayListIterator.remove()
method.
Acknowledgement
Many problems provided by Dr. Taylor