GENERIC TYPES AND THE
JAVA COLLECTIONS
FRAMEWORK
Lecture 15
CS2110 Spring 2013
Generic Types in Java
2
When using a collection (e.g.,
LinkedList, HashSet,
HashMap), we generally have a single
type T of elements that we store in it
(e.g., Integer, String)
PROVING THINGS ABOUT
CONCURRENT PROGRAMS
Lecture 24 CS2110 Spring 2013
Overview
2
Two weeks ago we looked at techniques for proving
things about recursive algorithms
We
saw that in general, recursion matches with the
notion of an inductive proof
How can
KarlMarx
TheGermanIdeology
Part I: Feuerbach.
Opposition of the Materialist and
Idealist Outlook
B. The Illusion of the Epoch
CivilSocietyandtheConceptionofHistory
The form of intercourse determined by the existing productive forces at all previous
histor
KarlMarx.TheGermanIdeology.1845
Part I: Feuerbach.
Opposition of the Materialist and
Idealist Outlook
A. Idealism and Materialism
TheIllusionsofGermanIdeology
As we hear from German ideologists, Germany has in the last few years gone through an
unparallel
KarlMarx
TheGermanIdeology
Part I: Feuerbach.
Opposition of the Materialist and
Idealist Outlook
D. Proletarians and
Communism
Individuals,Class,andCommunity
In the Middle Ages the citizens in each town were compelled to unite against the landed
nobilityt
KarlMarx
TheGermanIdeology
Part I: Feuerbach.
Opposition of the Materialist and
Idealist Outlook
C. The Real Basis of Ideology
DivisionofLabour:TownandCountry
[.][1]Fromthefirsttherefollowsthepremiseofahighlydevelopeddivisionoflabourand
anextensivecommerc
THE PROBLEM OF SOCIAL ORDER:
EGOISM OR AUTONOMY?
Arnout van de Rijt and Michael W. Macy
ABSTRACT
Individual rationality sometimes leads to collectively irrational outcomes,
a fundamental problem in the social and life sciences that has attracted
sustained
MIT OpenCourseWare http:/ocw.mit.edu
18.02 Multivariable Calculus
Fall 2007
For information about citing these materials or our Terms of Use, visit: http:/ocw.mit.edu/terms.
18.02 Practice Exam 1 A
z
Problem 1. (15 points)
A unit cube lies in the rst octa
MIT OpenCourseWare http:/ocw.mit.edu
18.02 Multivariable Calculus
Fall 2007
For information about citing these materials or our Terms of Use, visit: http:/ocw.mit.edu/terms.
18.02 Practice Exam 1B
Problem 1. Let P , Q and R be the points at 1 on the x-axi
MIT OpenCourseWare http:/ocw.mit.edu
18.02 Multivariable Calculus
Fall 2007
For information about citing these materials or our Terms of Use, visit: http:/ocw.mit.edu/terms.
18.02 Practice Exam 1 A Solutions
Problem 1. 1 1 a) OQ = + + k; OR = + + k. 2 2 1
MIT OpenCourseWare http:/ocw.mit.edu
18.02 Multivariable Calculus
Fall 2007
For information about citing these materials or our Terms of Use, visit: http:/ocw.mit.edu/terms.
18.02 Practice Exam 2 A
Problem 1. (10 points: 5, 5)
Let f (x, y ) = xy x4 .
a)
MIT OpenCourseWare http:/ocw.mit.edu
18.02 Multivariable Calculus
Fall 2007
For information about citing these materials or our Terms of Use, visit: http:/ocw.mit.edu/terms.
18.02 Practice Exam 1B Solutions
Problem 1. a) P = (1, 0, 0), Q = (0, 2, 0) and R
Mathematical Writing by Donald E. Knuth, Tracy Larrabee, and Paul M. Roberts This report is based on a course of the same name given at Stanford University during autumn quarter, 1987. Here's the catalog description: CS 209. Mathematical Writing-Issues of
Discrete Structures
CS2800 Fall 2013
Stirling Numbers
October 23, 2013
The text mentions Stirling numbers briey but does not go into them in any depth. However, they are
fascinating numbers with a lot of interesting properties, so I thought I would post a
CS/ENGRD 2110
FALL 2013
Lecture 1: Overview and intro to types
http:/courses.cs.cornell.edu/cs2110/2013fa
Welcome to CS2110!
2
Learning about:
OO, abstract data types, generics, Java Collections,
Reasoning about complex problems, analyzing algorithms w
STANDARD ADTS
Lecture 17
CS2110 Spring 2013
Abstract Data Types (ADTs)
2
A method for achieving
abstraction for data
structures and algorithms
ADT = model + operations
Describes what each
operation does, but not how
it does it
An ADT is independent of its
1
PRIORITY QUEUES AND
HEAPS
Lecture 18
CS2110 Spring 2013
The Bag Interface
2
A Bag:
interface Bag<E> cfw_
void insert(E obj);
E extract(); /extract some element
boolean isEmpty();
Examples: Stack, Queue, PriorityQueue
Stacks and Queues as Lists
3
Stack
GRAPHS
Lecture 19
CS2110 Spring 2013
Announcements
2
Prelim 2: Two and a half weeks from now
Tuesday,
April16, 7:30-9pm, Statler
Exam conflicts?
We
need to hear about them and can arrange a makeup
It would be the same day but 5:30-7:00
Old exams availab
JQL : The Java Query Language
Slides created by Darren Willis, David J Pearce,
James Noble; used with their permission
Object Querying
JQL is a simple extension for Java.
JQL adds support for Object Querying.
Object Querying helps us pick sets of objects
SORTING AND ASYMPTOTIC
COMPLEXITY
Lecture 14
CS2110 Spring 2013
InsertionSort
2
/sort a[], an array of int
Worst-case: O(n2)
for (int i = 1; i < a.length; i+) cfw_
(reverse-sorted input)
/ Push a[i] down to its sorted position
Best-case: O(n)
/
in a[0.i
QUANTUM COMPUTING
(AND OTHER SHORTCUTS FOR
SOLVING HARD PROBLEMS)
Lecture 28 CS2110 Spring 2013
The world isnt as simple as it seems!
2
Starting as early as the Greek philosophers, people
have wondered what the world is made of
Fire,
earth, water and air
THREADS AND
CONCURRENCY
Lecture 22 CS2110 Spring 2013
Graphs summary
2
Dijkstra: given a vertex v, finds shortest path from v
to x for each vertex x in the graph
Key
1.
2.
3.
idea: maintain a 5-part invariant on three sets
Vertices already visited (settl
Lecture 13
DFA State Minimization
By now you have probably come across several situations in which you have
observed that some automaton could be simplied either by deleting states
inaccessible from the start state or by collapsing states that were equiva
Lecture 9
Regular Expressions and Finite Automata
Simplication of Expressions
For small regular expressions, one can often see how to construct an equivalent automaton directly without going through the mechanical procedure of the
previous lecture. It is
A Course in Discrete Structures
Rafael Pass
Wei-Lung Dustin Tseng
Preface
Discrete mathematics deals with objects that come in discrete bundles, e.g.,
1 or 2 babies. In contrast, continuous mathematics deals with objects that
vary continuously, e.g., 3.42
MIT OpenCourseWare http:/ocw.mit.edu
18.02 Multivariable Calculus
Fall 2007
For information about citing these materials or our Terms of Use, visit: http:/ocw.mit.edu/terms.
18.02 Practice Exam 2 A Solutions
Problem 1. a) f = (y 4x3 ) + x; at P , f = 3, 1
MIT OpenCourseWare http:/ocw.mit.edu
18.02 Multivariable Calculus
Fall 2007
For information about citing these materials or our Terms of Use, visit: http:/ocw.mit.edu/terms.
18.02 Practice Exam 2 B
Problem 1. Let f (x, y ) = x2 y 2 x.
a) (5) Find f at (2
Common Derivatives and Integrals
Derivatives
Basic Properties/Formulas/Rules d ( cf ( x ) ) = cf ( x ) , c is any constant. ( f ( x ) g ( x ) ) = f ( x ) g ( x ) dx dn d ( c ) = 0 , c is any constant. ( x ) = nxn-1 , n is any number. dx dx f f g - f g (Qu
Calculus Cheat Sheet
Limits
Definitions
Precise Definition : We say lim f ( x ) = L if
Limit at Infinity : We say lim f ( x ) = L if we
x a
x
for every e > 0 there is a d > 0 such that
whenever 0 < x - a < d then f ( x ) - L < e .
can make f ( x ) as clo
Trig Cheat Sheet
Definition of the Trig Functions
Right triangle definition
For this definition we assume that
p
0 < q < or 0 < q < 90 .
2
Unit circle definition
For this definition q is any angle.
y
( x, y )
hypotenuse
y
opposite
1
q
x
x
q
adjacent
oppos