We finished Section 3.1 on relations and covered some material from Section 3.2. We started talking about searching in databases using linear search (Chapter 4). Next week we will finish Chapter 4 and continue by talking about puzzles, games, and combinatorics.
The midterm will be 5/7 for in-class students; for DL students, I will open registration sometime this week.
If you have any questions you want me to go over in preparation for the midterm, please send them to me by the end of the week (Sunday is fine).
Submission: you can submit the homework to me either by hardcopy in class or email it to me.
1. [Relations, 15pt] For each of the following relations R(x,y), state whether it is (a) reflexive, (b) symmetric and/or (c) transitive.
For each of the three properties briefly argue that the relation has the property or give a counterexample showing that it does not.
2. [Equivalence Classes, 10pt] Consider the relation R(x,y) = "|x| = |y|" over the universe of the real numbers, where |x| is the absolute value of x. E.g. |-3.5| = 3.5 and |19.3| = 19.3.
3. [SQL Queries, 30] For each SQL query, please submit your SQL and a printout of the resulting table. Be careful writing both of these, and make sure you double-check that your output is what you expect it to be.
4. [Relations, 12] On the natural numbers, {1,2,3, ...} we define a new relation a « b if a occurs in b as a sequence of digits. E.g. 3118 « 7131184 and 98 « 9820, but neither 1 « 928 nor 32 « 302.
5. [Extra Credit] Suppose we have two sets A and B ordered by some ordering relation ≤. Show that the relation ≤ on A x B defined as
(a,b) ≤ (c,d) if a ≤ c, or a = c and b ≤ d
is an ordering relation of A x B (intuitively: first order by A, then by B). Hint: show ≤ on A x B is reflexive, anti-symmetric and transitive.
6. [Extra Credit] The pair (x,y) can be defined using just sets in such a way that (a,b) = (c,d) if and only if the sets belonging to (a,b) and (c,d) are the same. A first attempt might be to define (x,y) as {x,y}, but that does not work as we know, since (x,y) <> (y,x) but {x,y} = {y,x}. (The point of this exercise is that pairs are not really necessary, they can be defined using sets, rather like and can be defined using or and not.)
7. [Extra Credit] If you find any typos and mistakes in the lecture notes, please let me know.