Lab 8

Statement Counts and Time Complexity

March 10, 2005

Lab Partners

Everyone should work with one lab partner on this assignment.

Purpose

The purpose of this in-lab is to give you more practical experience with statement counts and time complexity (in the context of linked lists). Based on the midterm results, most people can use some additional practice with these concepts. Statement counts and time complexity are important concepts that will appear on the final exam.

Before Lab Begins

Create a BlueJ project named inlab8 and add the following files to it:

In addition, you will need the following two data files:

Understand the Code

Run the code to see what output it produces. Look at the code to make sure that you understand how it works. Ask Mike or the lab consultants if you have any questions. If you spend enough time to understand the code, determining the correct statements counts and time complexities should be easier.

Statement Counts and Time Complexity - 10 points

Print out the LinkedList.java file. You will notice that all through the file, there are blank lines that look something like this: _______. Fill in each blank line with the appropriate statement count or time complexity. Notice that there are some comments at the top of each method that provide you with some important information that you are allowed to assume.

What to Submit

Before the end of the lab period, hand in your filled out print-out to Mike. Make sure that your name (and your partner's name) are on it.

Before Lab Ends

Delete any BlueJ projects that you created and empty the recycle bin. Thanks.

Enjoy Spring Break!