

























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Data Structures and Functional Programming; Subject: Computer Science; University: Cornell University; Term: Spring 2009;
Typology: Study notes
1 / 33
This page cannot be seen from the preview
Don't miss anything!


























Dan HuttenlocherCornell University Computer ScienceSpring 2009
^ Office, consultingh
t d
b
^ Jean-Baptiste Jeannin ^ Ed McTigue UG Consultants:
hours posted on web
^ UG Consultants:^
Andrew Owens Tanya Gupta
^ Consulting Sun, Tue,Wed, Thu evenings
^ Rick Ducott ^ Dane Wallinga ^ David Kupiec
^ Use TA, instructor
ffi^
h^
^ David Kupiec ^ Matt Pokryzwa ^ Jerzy HausknechtJ
b B
k
office hours!
^ J
acob Bank ^ Nyk Lotocky
Upson 109, at 2:30pm Upson 109, at 3:35pm Possible third section – early evening?N^
i l i
d i
l
d
ew material is presented in lecture
and
recitationAtt
d^
i^
t d
t l
t^
d^
it ti
^ Att
endance is expected at lecture
and
recitation
^ Participation counts
But you are also responsible for in-class material…
The Objective Caml System,
Leroy et al. (online)
^ Introduction to Objective Caml
Hickey (online)
^ Introduction
to Objective Caml
, Hickey. (online)
generally due Thursdays
problem sets – generally due Thursdays PS1 released Thursday, due Jan. 29: “OCaml Warmup” ^ Mix of programming, written problems ^ Submitted electronically via CMS^
24 hours late 10% penalty, 48 hours late 20% penalty ^ Four single-person assignments (1–4)
T^
k^
h
^ T
wo weeks each ^ Two two-person assignments (5–6)^
Three weeks each ^ Three
weeks each
Please don’t make us waste time on this Please don t make us waste time on this Automated tools readily reveal code similarity even ifyou try to hide it by changing names, spacing, etc. Written problems also often surprisingly easy to see
dead
e
designers and developers
of valuable software systems. 1) Programming
paradigms
2) Reasoningabout programs
3) Tools
paradigms New programming
about programs • Correctness
Data structuresand algorithms
p^
g^
g
language conceptsand constructs
and algorithms
reasoning andreuse
beyond OO/classes
^ Modular programming – beyond OO/classes ^ Concurrent programming – multi-core and UITypes and type inference^ Types
and type inference
The important part are the concepts, not the ML syntax!
e^
po ta t pa t a e t e co cepts,
ot t e
sy ta
Functional versions of these structures
Balanced trees: AVL, Red-Black, B-trees, splay trees Disjoint sets Hash tables Binary heaps Binary heaps
^ Analysis of correctness and performance
i t^
h^
l (V hi l
) {^
i^
++
t^
}
^ i
nt wheels(Vehicle v) { v.size++; return v.numw; }
x=x+
or
x++
^ Neither of these does anything remotely like
x++
let x = x+1 in xlet rec x = x+1 in x
^ Former assumes an existing binding for
x^
and
creates a new one (no modification of
x ) latter is
creates
a new one (no modification of
x ), latter is
invalid expression
Computer Program
Memory
^ Fantasy:
program interacts with a single system state
^ Interactions are reads from and writes to variables or fields^ Interactions are reads from and writes to variables or fields. ^ Reads and writes are very fast ^ Side effects are instantly seen by all parts of a program Reality today:
there is no single state
^ Reality
today:
there
is no single state
^ Multicores have own caches with inconsistent copies of state ^ Programs are spread across different cores and computers (PS5 & PS6) ^ Side effects in one thread may not be immediately visible in another ^ Side
effects in one thread may not be immediately visible in another ^ Imperative languages are a bad match to modern hardware and it’sonly getting worse