{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

l02-fancy-lists

# l02-fancy-lists - CS112 Data Structures Lecture 02 linked...

This preview shows pages 1–9. Sign up to view the full content.

CS112: Slides for Prof. Steinberg ʼ s lecture 1 Lecture 2 CS112: Data Structures CS112: Data Structures Lecture 02 linked lists

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS112: Slides for Prof. Steinberg ʼ s lecture 2 Lecture 2 CS112: Data Structures CS112: Data Structures Instructor: Prof. Louis Steinberg office: Hill 401 email: [email protected] Office hours: To be Announced TA: Binh Pham Office: Core 336 Email: [email protected] Office hours: 4-5pm Mondays
CS112: Slides for Prof. Steinberg ʼ s lecture 3 Lecture 2 Class Web Page Class Web Page http://sakai.rutgers.edu/ http://sakai.rutgers.edu/ Login with NETID Policies Syllabus Assignments Lecture notes etc .... You are assumed to know anything posted.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS112: Slides for Prof. Steinberg ʼ s lecture 4 Lecture 2 Review Review What is a Data Structure A way to store multiple pieces of data Stores some relationship among the pieces What to know about a DS What operations can we do? What do they cost? Time Memory space
CS112: Slides for Prof. Steinberg ʼ s lecture 5 Lecture 2 Review Review Asymptotic Costs Asymptotic Costs Problem: actual cost depends on many details We want a measure of cost that does not depend on these

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS112: Slides for Prof. Steinberg ʼ s lecture 6 Lecture 2 Review: Solutions Review: Solutions Count operations, not time Op count = f(input size) Among inputs of the same size, use worst or average op count Abstract away details of f: O(f) If O(f) > O(g), if n gets big enough f(n) will be larger than k * g(n)
CS112: Slides for Prof. Steinberg ʼ s lecture 7 Lecture 2 Example Example Arrays a1, a2 in increasing order, length=n Do they have any common element? int i1 = 0; int i2 = 0; while (i1 < n && i2 < n && a1[i1] != a2[i2]){ if (a1[i1]<a2[i2]){i1++;} else {i2++;}} if (i1 = = n || i2 = = n){ System.out.println("no");} else { System.out.println("yes ");

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS112: Slides for Prof. Steinberg ʼ s lecture 8 Lecture 2 Which Operations to Count?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 33

l02-fancy-lists - CS112 Data Structures Lecture 02 linked...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online