Top Banner
Linked Lists Linked Lists CSC 171 FALL 2001 LECTURE 20
23

Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Linked ListsLinked Lists

CSC 171 FALL 2001

LECTURE 20

Page 2: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

COURSE EVALUATIONSCOURSE EVALUATIONS

Tuesday, December 11th, in Lecture

Page 3: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Gentle Start BA in CSCGentle Start BA in CSC

FALL SPRING

Freshman MTH 150CSC 108

MTH 141CSC 170

Sophomore CSC 171MTH 142

CSC 172MTH 143

Junior CSC 173CSC 282

CSC 280CSC 252

Senior CSC 240WCSC 254(UL)

CSC 284(UL)CSC 248(UL)

Page 4: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

OTHELLO WINNERSOTHELLO WINNERS

4. Rotem Cohen

5. Matthew Pelmear

6. Andrew Regan

7. Justin Moore

8. Tyler Berry

9. Aaron Gallant

10. Dave Chapman

11. Jonathan Pearson

12. Kristin Robinson

13. Steve Carlton

14. Matthew Vukman

15. Preethum Prithviraj

16. Gregory Rubin

17. Benjamin Margolis

18. Lee Frankel-Goldwater

Page 5: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

OTHELLO WINNERSOTHELLO WINNERS

1. Micha Elsner

2. Liam Rafferty

3. Shonda Ranson

Page 6: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

History: Moore’s LawHistory: Moore’s Law1968 Dr. Gordon E.

Moore, co-founded Intel in 1968

Made his famous observation in 1965

Moore predicted that the number of transistors per integrated circuit would double every 18 months.

He forecast that this trend would continue through 1975.

Page 7: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Moore’s LawMoore’s Law

Page 8: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

If automobile speed had increased If automobile speed had increased similarly over the same period, you could similarly over the same period, you could

now drive from San Francisco to New now drive from San Francisco to New York in about 13 secondsYork in about 13 seconds

Intel 4004November 15, 1971Clock speed: 108

kilohertzNumber of transistors:

2,300 (10 microns)Bus width: 4 bitsAddressable memory:

640 bytes

Pentium® IIIOct. 25, 1999 Clock speed (600, 667,

and 733MHz)Number of transistors:

28 million (0.18-micron)

Bus Width: 64 bit Addressable Memory:

64 Gigabytes

Page 9: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

COMPUTE POWER REQUIREMENTS (MOREVIC)COMPUTE POWER REQUIREMENTS (MOREVIC)

Page 10: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

COMPUTE POWER PROJECTION (MOREVIC)COMPUTE POWER PROJECTION (MOREVIC)

Page 11: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Self-referential data typesSelf-referential data types

class Node {

private Object data; // the “data”

private Node next; // the “link”

}

data next

Page 12: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Linked ListLinked List

A linked list “has-a” reference to a node – The “head” of the list– The ending node has “null” for the next

data next data Next

null

head

Page 13: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Adding a first nodeAdding a first node

Page 14: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Adding a first nodeAdding a first node

public void addFirst(Object obj){

Link newLink = new Link();

newLink.data = obj;

newLink.next = first;

first = newLink;

}

Page 15: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Deleting a first nodeDeleting a first node

Page 16: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Deleting a first nodeDeleting a first node

public Object removeFirst(){

if (first == null)

throw new NoSuchElementException();

Object obj = first.data;

first = first.next;

return obj;

}

Page 17: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

A List IteratorA List Iterator

Page 18: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Iterator FunctionalityIterator Functionality

Page 19: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Iterator nextIterator nextpublic Object next() {

if (position == null){ position = first;return getFirst();

} else { if (position.next == null) throw new NoSuchElementException();previous = position; // remember for removeposition = position.next;return position.data;}

}

Page 20: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Adding to middleAdding to middle

Page 21: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Adding to middleAdding to middlepublic void add(Object obj){

if (position == null)addFirst(obj);

else { Link newLink = new Link();newLink.data = obj;newLink.next = position.next;position.next = newLink;position = newLink;previous = null;

}}

Page 22: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Removing from middleRemoving from middle

Page 23: Linked Lists CSC 171 FALL 2001 LECTURE 20 COURSE EVALUATIONS Tuesday, December 11 th, in Lecture.

Removing from middleRemoving from middlepublic void remove(){

if (position == first) removeFirst();

else{

if (previous == null)

throw new IllegalStateException();

previous.next = position.next;

position = previous;

}

previous = null;

}

}