l02-fancy-lists

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

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

View Full Document Right Arrow Icon
CS112: Slides for Prof. Steinberg ʼ s lecture 1 Lecture 2 CS112: Data Structures CS112: Data Structures Lecture 02 linked lists
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS112: Slides for Prof. Steinberg ʼ s lecture 2 Lecture 2 CS112: Data Structures CS112: Data Structures Instructor: Prof. Louis Steinberg office: Hill 401 email: lou@cs.rutgers.edu Office hours: To be Announced TA: Binh Pham Office: Core 336 Email: binhpham@cs.rutgers.edu Office hours: 4-5pm Mondays
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
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)
Background image of page 6
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; if (a1[i1]<a2[i2]){i1++;} else {i2++;}} if (i1 = = n || i2 = = n){ System.out.println("no");} else { System.out.println("yes ");
Background image of page 7

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

View Full DocumentRight Arrow Icon
CS112: Slides for Prof. Steinberg ʼ s lecture 8 Lecture 2 Which Operations to Count?
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online