Doubly-Linked Lists
Doubly-Linked Lists
15-121 Fall 2020 Margaret Reid-Miller
Today
? Exam 1: mean 86, high 98 Amazing!!
? Hw6 will be posted tonight ? Change Hw due dates?
Plan for Today ? Singly-linked list removed at index method ? Java's LinkedList class ? Doubly-linked lists
Fall 2020
15-121 (Reid-Miller)
2
Singly-linked list
? Add at index 3 ? Insert node between nodes at index 2 and 3. ? Think add "after 2," not "before 3," as you can always add AFTER a node. ? When do you need to consider a special case? When you add the first node (after head).
? Remove at index 3 ? Remove returns the value of the node removed. ? Like add, need to remove the node "after 2" ? Are there any special cases to consider?
Fall 2020
15-121 (Reid-Miller)
3
Exercise: Remove at given index
// Removes the object at the given index. // Returns the object removed
public E remove(int index) { if (index < 0 || index > size()) throw new IndexOutOfBoundsException();
Fall 2020
15-121 (Reid-Miller)
4
Remove at index 3 goal
first
null
2
remove here
obj
(index = 3)
Fall 2020
15-121 (Reid-Miller)
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- 4 3 stacks queues and linked lists university of pennsylvania
- singly linked lists cornell university
- linked list basics stanford university
- linked data structures i singly linked lists
- singly linked list class carnegie mellon university
- doubly linked lists
- lecture 09 structs and linked lists carnegie mellon university
- an introduction to linear linked list knight foundation school of
- linked lists and iterators university of bridgeport
- lecture 11 array of linked lists carnegie mellon university
Related searches
- doubly linked list in java
- java doubly linked list add
- generic doubly linked list java
- doubly linked list java documentation
- java doubly linked list implementation
- doubly linked list
- c doubly linked list
- doubly linked list insert
- doubly linked list python
- doubly linked list java
- doubly linked list implementation
- circular doubly linked list c