ECE 198
Homework 2
Due Early Week 3, On-Time Week 4
Last modified: 4/5/2002
- Always write the time-complexity (in Big Oh notation) in a comment next to every method or function you write in this class.
- Note submitting any program that you did not write yourself is plagerism (a very serious form of cheating) plus how can you learn anything unless you solve the program yourself. Anyone caught submitting a homework solution they did not author themselves will be prosecuted to the fullest extend of UCI law. Just as a reminder, please re-read my cheating policy.
Cheating policy.
- Use the test input and timers from homework 1. You may also use *your* solutions from previous homework as starts on these.
- (30 points) Write class OrderedLinkedList as presented in lecture using a tail pointer to allow O(1) additions to the end
- (30 points) Write class SortedArrayList as presented in lecture.
- use binary search to find elements in the list
- use insertion sort to keep it ordered, this should also use binary search to find where the new item to insert belongs
- (40 points) Write a driver program that allows the user to test your class implementations. Again use the PCTimer class to measure the following times
- the total time needed to insert all words from the test input file.
- the total time needed to find all every word from the test input file.
- the total time needed to remove all words given in the test input file.
- What to submit:
- Show your TA that both data structures work as described above.
- Submit (and save) your times for each data structure. We will build a comparison table for a final project at the end of the course.