---
tags: Setup
---
# Lecture 9 Setup/Prep
This lecture will pick up where lecture 8 left off: we have just realized that `addLast` is slower than `addFirst`, and we want to address that problem by adding a new field called `end` to the `LinkList` class. We will finish implementing `end`, then look at some other ways we could improve our implementation.
Note that the final code that I posted for lecture 8 has two interfaces for lists instead of one. In lecture, we started to use the same `IList` interface for each of `EmptyList`, `NodeList`, and `LinkList`. This is actually poor design: we should have two different interfaces: one for `LinkList` and another for `EmptyList` and `NodeList`. The posted code retains `IList` for `LinkList` and renames our old `IList` to `IListInternal`.
## Prep
Download the final version of the code from lecture 8 as [the initial code for lecture 9](https://brown-cs18-master.github.io/content/lectures/09listsoptimize/lec09.zip) (this link gets you a copy of the end-of-lecture-8 code in a `lec09` package).
See if you can explain why we should have two list interfaces instead of one.
Think about how we will maintain a reference to the end of the list in order to speed up the running time of `addLast`. Specifically:
- What should the initial value of the new `end` paramter be?
- What should the value of the `end` parameter be when the list is not empty?