opus:fall2012:tedmist1:discretepart2
Table of Contents
discrete Keyword 2
Intersection
Definition
Two sets A and B is the set that contains all elements of A that also belong to B (or equivalently, all elements of B that also belong to A), but no other elements.
Example:
The intersection of the sets {1, 2, 3} and {2, 3, 4} is {2, 3}.
References
- http://en.wikipedia.org/wiki/Intersection_(set_theory)
discrete Keyword 2 Phase 2
cartesian product
Definition
Cartesian Product is making one set that takes one from a set and pairs it with one value from another set. This is done for each of the values in each set. Example:
- {1, 2} * {up, down} = {(1, up), (1, down), (2, up), (2, down)}
- {1, 2, left} * {left, right, up, down} = {(1, left), (1, right), (1, up), (1, down), (2, left), (2, right), (2, up), (2, down), (left, left), (left, right), (left, up), (left, down)}
References
- ndp.jct.ac.il/tutorials/Discrete/node28.html
Demonstration
lab46:~$ ./cartesian Enter Array Size For Array A: 3 Enter Array A Elements: 1 2 4 Enter Array Size For Array B: 3 Enter Array B Elements: 5 7 9 Cartesian Product Of Array A & B: A = {1,2,4} & B = {5,7,9} A x B = {1,2} x {2,7} x {4,9} = {(1,5), (1,7), (1,9), (2,5), (2,7), (2,9), (4,5), (4,7), (4,9)} B x A = {4,9} x {2,7} x {1,2} = {(4,9), (4,7), (4,5), (2,9), (2,7), (2,5), (1,9), (1,7), (1,5)}
opus/fall2012/tedmist1/discretepart2.txt · Last modified: 2012/10/31 14:36 by tedmist1