January 2018 | ||||||
---|---|---|---|---|---|---|
U | M | T | W | R | F | S |
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | |||
Mon 5 Feb Lab 3 |
Loopty-Loopty Loop
This lab practices testing and timing running code to estimate its complexity.
|
Tue 6 Feb Lecture 7 |
Binary search
When searching for a value in a sorted array, examining the middle
element allows us to discard half of the array in the worst case.
The resulting algorithm, binary search, has logarithmic complexity
which is much better than linear search (which is linear).
Achieving a correct imperative implementation can be tricky however,
and we use once more contracts as a mechanism to reach this goal.
|
Thu 8 Feb Lecture 8 |
Quicksort
We use the key idea underlying binary search to implement two sorting
algorithms with better complexity than selection sort. We examine
one of them, quicksort, in detail, again using contracts to achieve
a correct implementation, this time a recursive implementation. We
observe that the asymptotic complexity of quicksort depends on the
the value of a quantity the algorithm use (the pivot) and discuss
ways to reduce the chances of making a bad choice for it. We
conclude by examining another sorting algorithm, mergesort, which is
immune from this issue.
|
Fri 9 Feb Recitation 4 |
A Strange Sort of Proof
This recitation reviews proving the correctness of functions.
|
Mon 26 Feb Lab 6 |
List(en) Up!
This lab practices working with linked lists.
|
Tue 27 Feb Lecture 12 |
Unbounded Arrays
When implementing a data structure for a homogeneous collection,
using an array has the advantage that each element can be accessed
in constant time, but the drawback that we must fix the number of
elements a priori. Linked lists can have arbitrarily length but
access takes linear time. Can we have the best of both worlds?
Unbounded arrays rely on an array to store the data, but double it
when we run out of place for new elements. The effect is that
adding an element can be either very cheap or very expensive
depending on how full the array is. However, a series of insertions
will appear as if each one of them takes constant time in average.
Showing that this is the case requires a technique called amortized
analysis, which we explore at length in this lecture.
|
Thu 1 Mar Lecture 13 |
Hash Tables
Associative arrays are data structures that allow efficiently
retrieving a value on the basis of a key: arrays are the special
case where valid indices into the array are the only possible keys.
One popular way to implement associative arrays is to use hash
tables, which computes an array index out of each key and uses that
index to find the associated value. However, multiple keys can map
to the same index, something called a collision. We discuss several
approaches to dealing with collisions, focusing on one called separate
chaining. The cost of access depends on the contents of the hash
table. While a worst case analysis is useful, it is not typically
representative of normal usage. We compute the average case
complexity of an access relative to as few simple parameters of the
hash table.
|
Fri 2 Mar Recitation 7 | waiting on id recitation7... |
Mon 12 Mar | waiting on id break... |
Tue 13 Mar | |
Thu 15 Mar | |
Fri 16 Mar |
Mon 26 Mar Lab 9 | waiting on id lab9... |
Tue 27 Mar Lecture 18 | waiting on id lecture18... |
Thu 29 Mar Lecture 19 | waiting on id lecture19... |
Fri 30 Mar Recitation 9 | waiting on id recitation9... |
Mon 2 Apr Lab 10 | waiting on id lab10... |
Tue 3 Apr Lecture 20 | waiting on id lecture20... |
Thu 5 Apr Midterm 2 | waiting on id e2... |
Fri 6 Apr Recitation 10 | waiting on id recitation10... |
Mon 9 Apr Lab 11 | waiting on id lab11... |
Tue 10 Apr Lecture 21 | waiting on id lecture21... |
Thu 12 Apr Lecture 22 | waiting on id lecture22... |
Fri 13 Apr Recitation 11 | waiting on id recitation11... |
Mon 16 Apr Lab 12 | waiting on id lab12... |
Tue 17 Apr Lecture 23 | waiting on id lecture23... |
Thu 19 Apr | waiting on id h3... |
Fri 20 Apr | waiting on id h4... |
Mon 23 Apr Lab 13 | waiting on id lab13... |
Tue 24 Apr Lecture 24 | waiting on id lecture24... |
Thu 26 Apr Lecture 25 | waiting on id lecture25... |
Fri 27 Apr Recitation 12 | waiting on id recitation12... |
Mon 30 Apr Lab 14 | waiting on id lab14... |
Tue 1 May Lecture 26 | waiting on id lecture26... |
Thu 3 May Lecture 27 | waiting on id lecture27... |
Fri 4 May Recitation 13 | waiting on id recitation13... |
Thu 10 May (5:30-8:30) [null] final | waiting on id FINAL... |
2018 Iliano Cervesato |