Lecture 19: Linked lists
Textbook chapters
3.2
Linked lists
Arrays have some drawbacks. Linked lists solve some of these.
We’ll build up a linked list implementation with these methods:
addFirst()addLast()removeFirst()size()first()last()isEmpty()
Files used in class
Additional problems
- Give a method of the
size()method, assuming we did not maintainsizeas a field inSinglyLinkedList.