130 likes | 259 Views
Chapter 2. Mathematical Preliminaries. Sets and Relations. A set is a collection of distinguishable members or elements The members are usually drawn from some larger base set Each member is either a primitive element of the base set or a set itself
E N D
Chapter 2 Mathematical Preliminaries
Sets and Relations • A set is a collection of distinguishable members or elements • The members are usually drawn from some larger base set • Each member is either a primitive element of the base set or a set itself • The is no concept of duplication in a set • Each value from the base type is either in the set or not • Example 3, 4, 5 are in set P and the base type is ints
Bags • Sometimes we wish to define a collection without order, like a set, but with duplicate items • Such a collection is called a bag • To distinguish a bag from a set we put square brackets around a bag’s elements
Sequences • A sequence is a collection of elements with an order and which may contain duplicate-value elements. • A sequence is also sometimes called a tuple or a vector • A sequence is indicated using angle brackets <>
A relation R over set S is a set of ordered pairs from S If tuple <x,y> is in relation R, we can show it as xRy We can define the following properties of relations: R is reflective if aRa for all a in S R is symmetric if whenever aRb, then bRa for all a,b in S R is antisymmetric if whenever aRb and bRa, then a=b for all a,b in S R is transitive if whenever aRb and bRc then aRc for all a,b,c in S Relation
Equivalence Relation • R is an equivalence relation on set S if it is reflexive, symmetric and transitive • An equivalence relation can be used to partition a set into equivalence classes • An equivalence relation on set S partitions the sets into subsets whose elements are equivalent
Partial Order • A binary relation is called a partial order if it is antisymmetric and transitive. • The set on which the partial order is defined is called a partially ordered set or a poset
Miscellaneous Notation • B means bytes • b means bits • KB is a kilobyte 210 = 1024 byes • MB is a megabyte 220 bytes • GB is a gigabyte 230 bytes
n! • The factorial function for integer n is the product of the numbers between 1 and n • Stirling’s approximation is n! ≈ √2πn(n/e)n
Recursion • Recursion is awesome!! • Two parts • Base case • Recursive call • You’ll see a lot more of recursion this semester
Proof Strategies • Proof by contradiction • Proof by Mathematical Induction • Base case • Inductive Hypothesis • (seem familiar)
Estimating • Estimating can be formalized by a three step process • Determine the major parameters that affect the problem • Derive an equation that relates the parameters to the equation • Select values for the parameters, and apply the equation to yield an estimated solution
Example • How many golf balls can fit in room that is 8” x 8” x 8” • Parameters: a golf ball is 1’ diameter • The room is 4096 cubic feet • You can fit 1728 golf balls in 1 cubic foot • So you can fit 4096 * 1728 total golf balls • 7,077,888 golf balls • The units do to match!!