Singly-Linked List Class - Carnegie Mellon University
Singly-Linked List Class
15-121 Fall 2020 Margaret Reid-Miller
Exam 1 during class Thursday
? Please email mrmiller@cs.cmu.edu if you will have any difficulties and need accommodations.
? Topics include everything except Linked Lists. ? Review Sessions:
? Sean: Today 5pm ? 6pm ? Margaret: Wednesday during lab (attendance
not required) ? Leah: Wednesday 5pm - 6pm
Fall 2020
15-121 (Reid-Miller)
2
Today
? Homework 5 problems and checkpoint: last day to submit was last night. ? Solution to problems will be posted on autolab later today.
? Today ? Implementing a generic Linked List class
Fall 2020
15-121 (Reid-Miller)
3
How to deal cards in HW5 card game.
? What are two ways to deal a card from a pile?
? pile.remove(0)
O(n)
? pile.remove(pile.size()-1) O(1)
? Which is easier to code? ? Which is the more efficient? The latter. Why?
? Never again will you get away with using remove(0) or add(0, E) if you can reframe the code to use remove and add at the end of the array list!
Fall 2020
15-121 (Reid-Miller)
5
Linked Lists
? Advantages:
? Don't need large blocks of contiguous memory.
? Breaks up an array into little pieces
? Can grow and shrink without copying data.
? Disadvantages:
? Access is sequential. Slow to access the middle of the list.
? What arrays/ArrayLists do well, linked list do poorly and vice versa.
Fall 2020
15-121 (Reid-Miller)
6
................
................
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
- linked lists bu
- linked lists colorado state university
- singly linked list class carnegie mellon university
- linked list example snode class edu
- learning exercise c linked list baumann
- linked list basics stanford university
- linked lists csu
- lecture notes on linked lists carnegie mellon university
- linked lists edu
- linked list classes linked list example virginia tech
Related searches
- add method linked list java
- java linked list insert in order
- create linked list in java
- for each in a linked list java
- linked list method java
- linked list java tutorial
- linked list java code
- java linked list methods
- linked list in java
- doubly linked list in java
- singly linked list in java
- singly linked list implementation java