Sections 3.4, 5.3, 6.2, 6.4, 6.5, 8.3.6 and 8.4 are less important than the others.
The problem is to describe in pseudo-codea method for multiplying an n x m matrix A and an m x p matrix B. Recall that if C is the matrix product of A and B, then C[i][j] is the sum of A[i][k] x B[k][j] for all k = 1, ..., m.
You should be prepared to present your solution in class.
Haskell modules can be used for specifying abstract data types in a similar way as interfaces are used in Java. (Another option is to use Haskell's classes.). Your task is to write a Haskell module for an abstract data type of finite sets with three functions. Here is how you write the module head and the definition of integer sets as integer lists
) wheremodule IntSet (
IntSet, < -- the type of sets of integers
member, -- Int -> IntSet -> Bool
union, -- IntSet -> IntSet -> IntSet
subset -- IntSet -> IntSet -> Bool
type IntSet = [Int]
...
Replace the "..." above by suitable implementations of the functions member, union, and subset.
In Bror Bjerner's notes you can find several examples of how modules can be used for specifying abstract data types. Look for example at the module Stack in chapter 3.
Try to make the functions as efficient as possible! What are the asymptotic complexities (using O)? Does it make sense to implement the membership function by binary search here?
You should be prepared to present your solution in class.