SlideShare a Scribd company logo
1 of 20
MATH203-1403A-02
Applications of Discrete
Mathematics
Phase 4 / IP 1
Mark L. Simon II
Instructor: Doris Schantz
July 31, 2014
Set Theory Revisited
• Look up a roulette wheel diagram. The following sets are definedA = the set of red numbers D = the set of even numbers
B = the set of black numbers E = the set of odd numbers
C = the set of green numbers F = {1,2,3,4,5,6,7,8,9,10,11,12}
For the purposes of this presentation, we will be using the American
Roulette Wheel as we are in America.
• The table of numbers to the right are for the American Roulette.
We will take from here to develop our sets.
• Red #’s “A” = {1, 3, 5, 7, 9, 12, 14, 16, 18, 21, 23, 25, 27, 28, 30, 32,
34, 36}
• Black #’s “B” = {2, 4, 6, 8, 10, 11, 13, 15, 17, 19, 20, 22, 24, 26, 29,
31, 33, 35}
• Green #’s “C” = {0, 00}
• Even #’s “D” = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
32, 34, 36}
• Odd #’s “E” = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 39, 31,
33, 35}
• Set “F” = {1,2,3,4,5,6,7,8,9,10,11,12}
Now that we a have assessed the determinant sets, we will
start assessing each of the below “U” – Unions and “∩” –
Intersections for each required configuration.
They are as follows :
• (A∪B) (A∩D) (B∩C) (C∪E) (B∩F) (E∩F)
{1, 3, 5, 7, 9, 12,
14, 16, 18, 21,
23, 25, 27, 28,
30, 32, 34, 36}
{2, 4, 6, 8, 10,
11, 13, 15, 17,
19, 20, 22, 24,
26, 29, 31, 33,
35
{1, 3, 5,
7, 9, 21,
23, 25, 27,}
{ 2, 4, 6, 8,
10, 20, 22,
24, 26, }
(A∩D) = {12, 14,16, 18, 28, 30, 32, 34,
36}
(A U B) = {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, 32, 33, 34, 35, 36}
U U
A B
A D
Null
12, 14,16,
18,28,30,
32,34,36
2, 4, 6, 8, 10,
11, 13, 15, 17,
19, 20, 22, 24,
26, 29, 31, 33,
35
0, 00 0, 00
1, 3, 5, 7, 9,
11, 13, 15, 17,
19, 21, 23, 25,
27, 39, 31, 33,
35
(B∩C) = {Φ} (C ∪ E) = {0, 00, 1, 3, 5, 7, 9, 11,
13, 15, 17,
19, 21, 23, 25, 27, 39, 31, 33,
35}
U U
B C C E
NullNull
13, 15, 17,
19, 20, 22, 24,
26, 29, 31, 33,
35
1,3,5,
7,9,12
13, 15, 17,
19, 21, 23,
25, 27, 39,
31, 33, 35
2,4,6,
8,10,12
(B ∩ F) = {2, 4, 6, 8, 10, 11} (E∩F) = {1, 3, 5, 7, 9, 11}
U U
B F E F
1, 3, 5, 7,
9, 11,
2, 4, 6,
8, 10, 11
Part II: Relations, Functions, and Sequences
The implementation of the program that runs the game involves testing. One of the necessary
tests is to see if the simulated spins are random. Create an n-ary relation, in table form, that
depicts possible results of 10 trials of the game. Include the following results of the game:
Number
Color
Odd or even (note: 0 and 00 are considered neither even nor odd.)
Trial # (P/K] Number Color Odd or Even
1 6 Black Even
2 33 Black Odd
3 12 Red Even
4 16 Black Even
5 10 Red Even
6 25 Red Odd
7 4 Black Even
8 36 Red Even
9 11 Black Odd
10 27 Red Odd
11 32 Red Even
Part 4: Automata Theory, Grammars and Languages
INSTRUCTIONS
• A gate with three rotating arms at waist height is used to control access to a
subway in New York city. Initially, the arms of the gate are locked preventing
customers from passing through. Unlocking the arms requires depositing a token
in a slot, which allows the arms to rotate to a complete turn which allows one
customer to push through and enter. Once the customer passes through the arms
are then locked again until another customer deposits another token in the slot.
• The gate has two states: LOCKED and UNLOCKED. It also has two inputs: TOKEN
and PUSH. When the gate is locked, pushing the arm of the gate has no effect
regardless of how many times it is pushed. The input TOKEN changes the state
from LOCKED to UNLOCKED. When the gate is in the UNLOCKED state, inserting
additional tokens has no effect on the state. But when in the UNLOCKED state, a
PUSH input changes the state to LOCKED.
• (i). Provide a transition table showing each state, the inputs, and the resulting
new states for each input
• (ii). Represent your transition table into a digraph (transition diagram)
Part - 4: Automata Theory,
Grammars and Languages
START
STATE
INPUT NEXT STATE OUTPUT
LOCKED
TOKEN INSERTED UNLOCK Turn Stile OPEN
PUSH BAR LOCKED Turn Stile LOCKED
UNLOCK
TOKEN INSERTED UNLOCK Turn Stile LOCKED
PUSH LOCKED After Turn Stile
Pushed / Locked
• Provided is a transition table showing each state, the inputs, and the resulting
new states and output for each input
• Below is a representation of a transition table into a digraph (transition diagram)
LOCKED UN
LOCKEDPush Coin
Push
Coin
Part - 4: Automata Theory,
Grammars and Languages
• Here is a context-free grammar that can be used to generate algebraic
expressions via the arithmetic operators (addition, subtraction, multiplication,
and division), in the variables p, q, and r. The letter E stands for expression:
• Rule 1: E —› p
• Rule 2: E —› q
• Rule 3: E —› r
• Rule 4: E —› E + E
• Rule 5: E —› E – E
• Rule 6: E —› E X E
• Rule 7: E —› E/E
• Rule 8: E —›(E)
Use the above grammar to derive the string given by the mathematical expression E
= (p + q) X p – r X p/(q + q)
Grammars and Languages - Continued
E = (p + q) X p – r X p/(q + q)
 E ( the start symbol)
 E – E ( by rule 5, applied to the middle)
 E – E * E (by rule 6, applied to the rightmost E)
 (E) * E – E * E (by rule 6, applied to the leftmost E)
 (E) * E – E * E/(E) (By Rule 8, applied to the rightmost E)
 (E + E) * E – E * E/(E) (By Rule 4 of the leftmost E)
 (E + E) * E – E * E/(E + E) (By Rule 4 applied to the rightmost E)
 (p + E) * E – E * E/(E + E) ( by rule 1 , by the leftmost E )
 (p + q) * E – E * E/(E + E) ( by rule 2 , by the leftmost E )
 (p + q) * p – E * E/(E + E) ( by rule 1 , by the leftmost E )
 (p + q) * p – E * E/(E + q) ( by rule 2 , by the rightmost E )
 (p + q) * p – E * E/(q + q) ( by rule 2 , by the rightmost E )
 (p + q) * p – E * p/(q + q) ( by rule 1 , by the rightmost E )
 (p + q) * p – r * p/(q + q) ( by rule 3 , by the rightmost E )
Part - 4: Continued
Automata Theory, Grammars and Languages
E
/ | 
E - E
/ |  / | 
E * E E * E
/| | | /|
( E ) p r E / E
/| | /|
E + E p ( E )
| | /|
p q E + E
| |
q q
(E + E) * E – E * E/(E + E)
to
(p + q) * p – r * p/(q + q)
To the right is my attempt
to accomplish the sparse
tree configuration. As is
seen, the initial inner
variables break down
pretty easily, but the
outer configurations take
a little more break down
to accomplish the sparse
tree.
P/V - Algorithm Analysis
• Consider searching algorithms on the following array of data:[22 21 9 4 16 2 10 14 20 31 26
19 17 28 8 13]
• Suppose you want to implement a searching algorithm to see if the data set contains the
number 19. Demonstrate how the search would go if you used:
– A sequential search
– A binary search
• State the runtime for each of the searches, in this example, and for general data sets of
size n. Address the issue of the order of the data in binary searching.
• Suppose an algorithm that processes a data set of size 8 has a runtime of 72. The same
algorithm has a runtime of 110 when applied to a data set of size 10; and when applied to
a data set of size 20, it has a runtime of 420. Using big-O notation, state the runtime for
this algorithm for the general case of a data set of size n.
• Suppose you develop an algorithm that processes the first element of an array (length
of n), then processes the first 2 elements, then the first 3 elements, and so on, until the
last iteration of a loop, when it processes all elements. Thus, if n = 4, the runtime would be
1 + 2 + 3 + 4 = 10.
– Create a table that depicts the runtime for arrays of length 1 to 10. Would you expect
the general runtime to be O(n), O(n2), O(n3), or some other function of n? Explain.
P/V - Algorithm Analysis
This algorithm finds an object “x” (number, string) from a
given set A where |A| = n.
Input: x, A, n
Output: index // location of x in set A
(array A)
seq_search(x, A, n)
{ i = 1
while (i <= n and x ~= A(i)) i = i + 1
if (i <= n) then index = i
else index = 0
return index
}
Algorithmic Sequential (Linear)
Search
Input: x = 19, A = {22, 21, 9, 4, 16, 2, 10, 14, 20, 31, 26, 19, 17, 28, 8, 13}, n = 16
It took 13 steps (same as n). It could have been as much as 16 and as little as 2. The
worst case seems to be n + 1 steps to find x.
Step 1: test: 1 < 16 and 19 ~= 22 true i = 2 Step 9: test:9 < 16 and 19 ~= 20 true I =10
Step 2: test: 2 < 16 and 19 ~= 21 true i = 3 Step 10: test: 10 < 16 and 19 ~= 31 true i = 11
Step 3: test: 3 < 16 and 19 ~= 9 true i = 4 Step 11: test: 11 < 16 and 19 ~= 26 true i = 12
Step 4: test: 4 < 16 and 19 ~= 4 true i = 5 Step 12: test: 12 < 16 and 19 ~= 19 false i = 13
Step 5: test: 5 < 16 and 19 ~= 16 true i = 6 Step 13: test: 12 < 16 true index = 19
Step 6: test: 6 < 16 and 19 ~= 2 true i = 7
Step 7: test: 7 < 16 and 19 ~= 10 true i = 8
Step 8: test: 8 < 16 and 19 ~= 14 true i = 9
Algorithmic Sequential (Binary)
Search
This algorithm performs a binary search to find “x” in a set
– (A). The algorithm determines the location of “x”. Using
the same set in the sequential search we will run the binary
algorithm.
Input: x, A, n
Output: index // location of x in A
Binary search (x, A, n)
{ i = 1, j = n
while ( i < j)
m =int[(i + j)/2]
if (x > A(m)) then i = m + 1
else j = m
if x = A(i) then index = i
else index = 0
}
The Binary Search
Search for 19 in the set A = {2,4,8, 9, 10, 13, 14, 16, 17, 19, 20, 21, 22, 26, 28, 31}
Sorted list = {2, 4, 8, 9, 10, 13, 14, 16, 17, 19, 20, 21, 22, 26, 28, 31}, n = 16
2 4 8 9 10 13 14 16 17 19 20 21 22 26 28 31
Int[(15 + 1)/2] = 8th cell ↑ 16 < 19  1st set
2 4 8 9 10 13 14 16 17 19 20 21 22 26 28 31
Int[( 7 + 1)/2] = 4th cell ↑ 21 > 19  2nd set
2 4 8 9 10 13 14 16 17 19 20 21 22 26 28 31
Int[(4 + 1)/2] = 2nd cell ↑ 19 = 19  index found
It took 3 steps for index found (same as n). It could have been as much as 4 and as
little as 3. The worst case seems to be int(n+1/2) steps to find x. Therefore, a
binary search is quicker in loop search then a sequential search.
P/V - Algorithm Analysis
P/V - Algorithm Analysis
P/V - Algorithm Analysis

More Related Content

What's hot

cbse class 12 math question paper
cbse class 12 math question papercbse class 12 math question paper
cbse class 12 math question paperPady Srini
 
1.5 algebraic and elementary functions
1.5 algebraic and elementary functions1.5 algebraic and elementary functions
1.5 algebraic and elementary functionsmath265
 
SSC STUDY MATERIAL
SSC STUDY MATERIALSSC STUDY MATERIAL
SSC STUDY MATERIALAvula Yadav
 
1.2 algebraic expressions
1.2 algebraic expressions1.2 algebraic expressions
1.2 algebraic expressionsmath260
 
Presentacion calculo1
Presentacion calculo1Presentacion calculo1
Presentacion calculo1jantrevino
 
10.5 more on language of functions x
10.5 more on language of functions x10.5 more on language of functions x
10.5 more on language of functions xmath260
 
1.2 review on algebra 2-sign charts and inequalities
1.2 review on algebra 2-sign charts and inequalities1.2 review on algebra 2-sign charts and inequalities
1.2 review on algebra 2-sign charts and inequalitiesmath265
 
Complex function
Complex functionComplex function
Complex functionShrey Patel
 
Assignment chapters 3 to 7
Assignment chapters 3 to 7Assignment chapters 3 to 7
Assignment chapters 3 to 7KarunaGupta1982
 
1.6 sign charts and inequalities t
1.6 sign charts and inequalities t1.6 sign charts and inequalities t
1.6 sign charts and inequalities tmath260
 
11 graphs of first degree functions x
11 graphs of first degree functions x11 graphs of first degree functions x
11 graphs of first degree functions xmath260
 

What's hot (18)

cbse class 12 math question paper
cbse class 12 math question papercbse class 12 math question paper
cbse class 12 math question paper
 
1.5 algebraic and elementary functions
1.5 algebraic and elementary functions1.5 algebraic and elementary functions
1.5 algebraic and elementary functions
 
Mathematics xii paper 13 with answer with value vased questions
Mathematics xii paper 13 with answer with value vased questionsMathematics xii paper 13 with answer with value vased questions
Mathematics xii paper 13 with answer with value vased questions
 
SSC STUDY MATERIAL
SSC STUDY MATERIALSSC STUDY MATERIAL
SSC STUDY MATERIAL
 
1.2 algebraic expressions
1.2 algebraic expressions1.2 algebraic expressions
1.2 algebraic expressions
 
Presentacion calculo1
Presentacion calculo1Presentacion calculo1
Presentacion calculo1
 
10.5 more on language of functions x
10.5 more on language of functions x10.5 more on language of functions x
10.5 more on language of functions x
 
1.2 review on algebra 2-sign charts and inequalities
1.2 review on algebra 2-sign charts and inequalities1.2 review on algebra 2-sign charts and inequalities
1.2 review on algebra 2-sign charts and inequalities
 
Complex function
Complex functionComplex function
Complex function
 
Assignment chapters 3 to 7
Assignment chapters 3 to 7Assignment chapters 3 to 7
Assignment chapters 3 to 7
 
Skills In Add Maths
Skills In Add MathsSkills In Add Maths
Skills In Add Maths
 
Solving linear equation
Solving linear equationSolving linear equation
Solving linear equation
 
Set 1 mawar
Set 1 mawarSet 1 mawar
Set 1 mawar
 
G05834551
G05834551G05834551
G05834551
 
Algebreviewer
AlgebreviewerAlgebreviewer
Algebreviewer
 
1.6 sign charts and inequalities t
1.6 sign charts and inequalities t1.6 sign charts and inequalities t
1.6 sign charts and inequalities t
 
CBSE Sample Paper Mathematics Class XII - 2015
CBSE Sample Paper  Mathematics Class XII  - 2015CBSE Sample Paper  Mathematics Class XII  - 2015
CBSE Sample Paper Mathematics Class XII - 2015
 
11 graphs of first degree functions x
11 graphs of first degree functions x11 graphs of first degree functions x
11 graphs of first degree functions x
 

Similar to MATH203 Discrete Math Set Theory Relations

Similar to MATH203 Discrete Math Set Theory Relations (20)

algorithm Unit 3
algorithm Unit 3algorithm Unit 3
algorithm Unit 3
 
Deret aritmatika
Deret aritmatikaDeret aritmatika
Deret aritmatika
 
Ee693 sept2014quiz1
Ee693 sept2014quiz1Ee693 sept2014quiz1
Ee693 sept2014quiz1
 
Unit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptxUnit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptx
 
Order-Picking-Policies.ppt
Order-Picking-Policies.pptOrder-Picking-Policies.ppt
Order-Picking-Policies.ppt
 
Ee693 sept2014quizgt2
Ee693 sept2014quizgt2Ee693 sept2014quizgt2
Ee693 sept2014quizgt2
 
Unit 3 daa
Unit 3 daaUnit 3 daa
Unit 3 daa
 
Project2
Project2Project2
Project2
 
Algebreviewer
AlgebreviewerAlgebreviewer
Algebreviewer
 
Greek logic and mathematics
Greek logic and mathematicsGreek logic and mathematics
Greek logic and mathematics
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programming
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................
 
Lecture#9
Lecture#9Lecture#9
Lecture#9
 
CSE680-07QuickSort.pptx
CSE680-07QuickSort.pptxCSE680-07QuickSort.pptx
CSE680-07QuickSort.pptx
 
Mit6 006 f11_quiz1
Mit6 006 f11_quiz1Mit6 006 f11_quiz1
Mit6 006 f11_quiz1
 
maths 12th.pdf
maths 12th.pdfmaths 12th.pdf
maths 12th.pdf
 
01 FUNCTIONS.pptx
01 FUNCTIONS.pptx01 FUNCTIONS.pptx
01 FUNCTIONS.pptx
 
Mathematics
MathematicsMathematics
Mathematics
 
Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questions
 

More from Mark Simon

Introduction To Programming IP5
Introduction To Programming IP5Introduction To Programming IP5
Introduction To Programming IP5Mark Simon
 
CSS-454 information Security Assurance CAPSTONE
CSS-454 information Security Assurance CAPSTONECSS-454 information Security Assurance CAPSTONE
CSS-454 information Security Assurance CAPSTONEMark Simon
 
City Hall Network Project
City Hall Network ProjectCity Hall Network Project
City Hall Network ProjectMark Simon
 
IT-106 Pseudo-Coding Wk 5
IT-106 Pseudo-Coding Wk 5IT-106 Pseudo-Coding Wk 5
IT-106 Pseudo-Coding Wk 5Mark Simon
 
Phase 3 IP Discrete Mathematics - Vertexes & Hierarchical Trees
Phase 3 IP Discrete Mathematics - Vertexes & Hierarchical TreesPhase 3 IP Discrete Mathematics - Vertexes & Hierarchical Trees
Phase 3 IP Discrete Mathematics - Vertexes & Hierarchical TreesMark Simon
 
Discrete Mathematics - Matrices & Matrix IP2
Discrete Mathematics - Matrices & Matrix IP2Discrete Mathematics - Matrices & Matrix IP2
Discrete Mathematics - Matrices & Matrix IP2Mark Simon
 
ENG101- Week 5 Individual Project
ENG101- Week 5 Individual ProjectENG101- Week 5 Individual Project
ENG101- Week 5 Individual ProjectMark Simon
 
Mark Simon IT 245 Introduction to Network Management
Mark Simon IT 245 Introduction to Network ManagementMark Simon IT 245 Introduction to Network Management
Mark Simon IT 245 Introduction to Network ManagementMark Simon
 
Greenhouse Effect IP3
Greenhouse Effect IP3Greenhouse Effect IP3
Greenhouse Effect IP3Mark Simon
 
Materials, Semi-conductors and Micro-Chips
Materials, Semi-conductors and Micro-ChipsMaterials, Semi-conductors and Micro-Chips
Materials, Semi-conductors and Micro-ChipsMark Simon
 
What you eat phase 1
What you eat   phase 1What you eat   phase 1
What you eat phase 1Mark Simon
 

More from Mark Simon (12)

Introduction To Programming IP5
Introduction To Programming IP5Introduction To Programming IP5
Introduction To Programming IP5
 
CSS-454 information Security Assurance CAPSTONE
CSS-454 information Security Assurance CAPSTONECSS-454 information Security Assurance CAPSTONE
CSS-454 information Security Assurance CAPSTONE
 
City Hall Network Project
City Hall Network ProjectCity Hall Network Project
City Hall Network Project
 
IT-106 Pseudo-Coding Wk 5
IT-106 Pseudo-Coding Wk 5IT-106 Pseudo-Coding Wk 5
IT-106 Pseudo-Coding Wk 5
 
Phase 3 IP Discrete Mathematics - Vertexes & Hierarchical Trees
Phase 3 IP Discrete Mathematics - Vertexes & Hierarchical TreesPhase 3 IP Discrete Mathematics - Vertexes & Hierarchical Trees
Phase 3 IP Discrete Mathematics - Vertexes & Hierarchical Trees
 
Discrete Mathematics - Matrices & Matrix IP2
Discrete Mathematics - Matrices & Matrix IP2Discrete Mathematics - Matrices & Matrix IP2
Discrete Mathematics - Matrices & Matrix IP2
 
Phase 1 ip
Phase 1 ipPhase 1 ip
Phase 1 ip
 
ENG101- Week 5 Individual Project
ENG101- Week 5 Individual ProjectENG101- Week 5 Individual Project
ENG101- Week 5 Individual Project
 
Mark Simon IT 245 Introduction to Network Management
Mark Simon IT 245 Introduction to Network ManagementMark Simon IT 245 Introduction to Network Management
Mark Simon IT 245 Introduction to Network Management
 
Greenhouse Effect IP3
Greenhouse Effect IP3Greenhouse Effect IP3
Greenhouse Effect IP3
 
Materials, Semi-conductors and Micro-Chips
Materials, Semi-conductors and Micro-ChipsMaterials, Semi-conductors and Micro-Chips
Materials, Semi-conductors and Micro-Chips
 
What you eat phase 1
What you eat   phase 1What you eat   phase 1
What you eat phase 1
 

Recently uploaded

The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringSebastiano Panichella
 
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)Basil Achie
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Salam Al-Karadaghi
 
LANDMARKS AND MONUMENTS IN NIGERIA.pptx
LANDMARKS  AND MONUMENTS IN NIGERIA.pptxLANDMARKS  AND MONUMENTS IN NIGERIA.pptx
LANDMARKS AND MONUMENTS IN NIGERIA.pptxBasil Achie
 
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝soniya singh
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Krijn Poppe
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSebastiano Panichella
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxFamilyWorshipCenterD
 
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...NETWAYS
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )Pooja Nehwal
 
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...NETWAYS
 
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...NETWAYS
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfhenrik385807
 
Microsoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AIMicrosoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AITatiana Gurgel
 
Philippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptPhilippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptssuser319dad
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxmavinoikein
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Pooja Nehwal
 
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...NETWAYS
 

Recently uploaded (20)

The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software Engineering
 
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
 
LANDMARKS AND MONUMENTS IN NIGERIA.pptx
LANDMARKS  AND MONUMENTS IN NIGERIA.pptxLANDMARKS  AND MONUMENTS IN NIGERIA.pptx
LANDMARKS AND MONUMENTS IN NIGERIA.pptx
 
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
 
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
 
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
 
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
 
Microsoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AIMicrosoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AI
 
Philippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptPhilippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.ppt
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptx
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
 
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
 

MATH203 Discrete Math Set Theory Relations

  • 1. MATH203-1403A-02 Applications of Discrete Mathematics Phase 4 / IP 1 Mark L. Simon II Instructor: Doris Schantz July 31, 2014
  • 2. Set Theory Revisited • Look up a roulette wheel diagram. The following sets are definedA = the set of red numbers D = the set of even numbers B = the set of black numbers E = the set of odd numbers C = the set of green numbers F = {1,2,3,4,5,6,7,8,9,10,11,12} For the purposes of this presentation, we will be using the American Roulette Wheel as we are in America.
  • 3. • The table of numbers to the right are for the American Roulette. We will take from here to develop our sets. • Red #’s “A” = {1, 3, 5, 7, 9, 12, 14, 16, 18, 21, 23, 25, 27, 28, 30, 32, 34, 36} • Black #’s “B” = {2, 4, 6, 8, 10, 11, 13, 15, 17, 19, 20, 22, 24, 26, 29, 31, 33, 35} • Green #’s “C” = {0, 00} • Even #’s “D” = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36} • Odd #’s “E” = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 39, 31, 33, 35} • Set “F” = {1,2,3,4,5,6,7,8,9,10,11,12} Now that we a have assessed the determinant sets, we will start assessing each of the below “U” – Unions and “∩” – Intersections for each required configuration. They are as follows : • (A∪B) (A∩D) (B∩C) (C∪E) (B∩F) (E∩F)
  • 4. {1, 3, 5, 7, 9, 12, 14, 16, 18, 21, 23, 25, 27, 28, 30, 32, 34, 36} {2, 4, 6, 8, 10, 11, 13, 15, 17, 19, 20, 22, 24, 26, 29, 31, 33, 35 {1, 3, 5, 7, 9, 21, 23, 25, 27,} { 2, 4, 6, 8, 10, 20, 22, 24, 26, } (A∩D) = {12, 14,16, 18, 28, 30, 32, 34, 36} (A U B) = {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, 32, 33, 34, 35, 36} U U A B A D Null 12, 14,16, 18,28,30, 32,34,36
  • 5. 2, 4, 6, 8, 10, 11, 13, 15, 17, 19, 20, 22, 24, 26, 29, 31, 33, 35 0, 00 0, 00 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 39, 31, 33, 35 (B∩C) = {Φ} (C ∪ E) = {0, 00, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 39, 31, 33, 35} U U B C C E NullNull
  • 6. 13, 15, 17, 19, 20, 22, 24, 26, 29, 31, 33, 35 1,3,5, 7,9,12 13, 15, 17, 19, 21, 23, 25, 27, 39, 31, 33, 35 2,4,6, 8,10,12 (B ∩ F) = {2, 4, 6, 8, 10, 11} (E∩F) = {1, 3, 5, 7, 9, 11} U U B F E F 1, 3, 5, 7, 9, 11, 2, 4, 6, 8, 10, 11
  • 7. Part II: Relations, Functions, and Sequences The implementation of the program that runs the game involves testing. One of the necessary tests is to see if the simulated spins are random. Create an n-ary relation, in table form, that depicts possible results of 10 trials of the game. Include the following results of the game: Number Color Odd or even (note: 0 and 00 are considered neither even nor odd.) Trial # (P/K] Number Color Odd or Even 1 6 Black Even 2 33 Black Odd 3 12 Red Even 4 16 Black Even 5 10 Red Even 6 25 Red Odd 7 4 Black Even 8 36 Red Even 9 11 Black Odd 10 27 Red Odd 11 32 Red Even
  • 8. Part 4: Automata Theory, Grammars and Languages INSTRUCTIONS • A gate with three rotating arms at waist height is used to control access to a subway in New York city. Initially, the arms of the gate are locked preventing customers from passing through. Unlocking the arms requires depositing a token in a slot, which allows the arms to rotate to a complete turn which allows one customer to push through and enter. Once the customer passes through the arms are then locked again until another customer deposits another token in the slot. • The gate has two states: LOCKED and UNLOCKED. It also has two inputs: TOKEN and PUSH. When the gate is locked, pushing the arm of the gate has no effect regardless of how many times it is pushed. The input TOKEN changes the state from LOCKED to UNLOCKED. When the gate is in the UNLOCKED state, inserting additional tokens has no effect on the state. But when in the UNLOCKED state, a PUSH input changes the state to LOCKED. • (i). Provide a transition table showing each state, the inputs, and the resulting new states for each input • (ii). Represent your transition table into a digraph (transition diagram)
  • 9. Part - 4: Automata Theory, Grammars and Languages START STATE INPUT NEXT STATE OUTPUT LOCKED TOKEN INSERTED UNLOCK Turn Stile OPEN PUSH BAR LOCKED Turn Stile LOCKED UNLOCK TOKEN INSERTED UNLOCK Turn Stile LOCKED PUSH LOCKED After Turn Stile Pushed / Locked • Provided is a transition table showing each state, the inputs, and the resulting new states and output for each input • Below is a representation of a transition table into a digraph (transition diagram) LOCKED UN LOCKEDPush Coin Push Coin
  • 10. Part - 4: Automata Theory, Grammars and Languages • Here is a context-free grammar that can be used to generate algebraic expressions via the arithmetic operators (addition, subtraction, multiplication, and division), in the variables p, q, and r. The letter E stands for expression: • Rule 1: E —› p • Rule 2: E —› q • Rule 3: E —› r • Rule 4: E —› E + E • Rule 5: E —› E – E • Rule 6: E —› E X E • Rule 7: E —› E/E • Rule 8: E —›(E) Use the above grammar to derive the string given by the mathematical expression E = (p + q) X p – r X p/(q + q)
  • 11. Grammars and Languages - Continued E = (p + q) X p – r X p/(q + q)  E ( the start symbol)  E – E ( by rule 5, applied to the middle)  E – E * E (by rule 6, applied to the rightmost E)  (E) * E – E * E (by rule 6, applied to the leftmost E)  (E) * E – E * E/(E) (By Rule 8, applied to the rightmost E)  (E + E) * E – E * E/(E) (By Rule 4 of the leftmost E)  (E + E) * E – E * E/(E + E) (By Rule 4 applied to the rightmost E)  (p + E) * E – E * E/(E + E) ( by rule 1 , by the leftmost E )  (p + q) * E – E * E/(E + E) ( by rule 2 , by the leftmost E )  (p + q) * p – E * E/(E + E) ( by rule 1 , by the leftmost E )  (p + q) * p – E * E/(E + q) ( by rule 2 , by the rightmost E )  (p + q) * p – E * E/(q + q) ( by rule 2 , by the rightmost E )  (p + q) * p – E * p/(q + q) ( by rule 1 , by the rightmost E )  (p + q) * p – r * p/(q + q) ( by rule 3 , by the rightmost E )
  • 12. Part - 4: Continued Automata Theory, Grammars and Languages E / | E - E / | / | E * E E * E /| | | /| ( E ) p r E / E /| | /| E + E p ( E ) | | /| p q E + E | | q q (E + E) * E – E * E/(E + E) to (p + q) * p – r * p/(q + q) To the right is my attempt to accomplish the sparse tree configuration. As is seen, the initial inner variables break down pretty easily, but the outer configurations take a little more break down to accomplish the sparse tree.
  • 13. P/V - Algorithm Analysis • Consider searching algorithms on the following array of data:[22 21 9 4 16 2 10 14 20 31 26 19 17 28 8 13] • Suppose you want to implement a searching algorithm to see if the data set contains the number 19. Demonstrate how the search would go if you used: – A sequential search – A binary search • State the runtime for each of the searches, in this example, and for general data sets of size n. Address the issue of the order of the data in binary searching. • Suppose an algorithm that processes a data set of size 8 has a runtime of 72. The same algorithm has a runtime of 110 when applied to a data set of size 10; and when applied to a data set of size 20, it has a runtime of 420. Using big-O notation, state the runtime for this algorithm for the general case of a data set of size n. • Suppose you develop an algorithm that processes the first element of an array (length of n), then processes the first 2 elements, then the first 3 elements, and so on, until the last iteration of a loop, when it processes all elements. Thus, if n = 4, the runtime would be 1 + 2 + 3 + 4 = 10. – Create a table that depicts the runtime for arrays of length 1 to 10. Would you expect the general runtime to be O(n), O(n2), O(n3), or some other function of n? Explain.
  • 14. P/V - Algorithm Analysis This algorithm finds an object “x” (number, string) from a given set A where |A| = n. Input: x, A, n Output: index // location of x in set A (array A) seq_search(x, A, n) { i = 1 while (i <= n and x ~= A(i)) i = i + 1 if (i <= n) then index = i else index = 0 return index }
  • 15. Algorithmic Sequential (Linear) Search Input: x = 19, A = {22, 21, 9, 4, 16, 2, 10, 14, 20, 31, 26, 19, 17, 28, 8, 13}, n = 16 It took 13 steps (same as n). It could have been as much as 16 and as little as 2. The worst case seems to be n + 1 steps to find x. Step 1: test: 1 < 16 and 19 ~= 22 true i = 2 Step 9: test:9 < 16 and 19 ~= 20 true I =10 Step 2: test: 2 < 16 and 19 ~= 21 true i = 3 Step 10: test: 10 < 16 and 19 ~= 31 true i = 11 Step 3: test: 3 < 16 and 19 ~= 9 true i = 4 Step 11: test: 11 < 16 and 19 ~= 26 true i = 12 Step 4: test: 4 < 16 and 19 ~= 4 true i = 5 Step 12: test: 12 < 16 and 19 ~= 19 false i = 13 Step 5: test: 5 < 16 and 19 ~= 16 true i = 6 Step 13: test: 12 < 16 true index = 19 Step 6: test: 6 < 16 and 19 ~= 2 true i = 7 Step 7: test: 7 < 16 and 19 ~= 10 true i = 8 Step 8: test: 8 < 16 and 19 ~= 14 true i = 9
  • 16. Algorithmic Sequential (Binary) Search This algorithm performs a binary search to find “x” in a set – (A). The algorithm determines the location of “x”. Using the same set in the sequential search we will run the binary algorithm. Input: x, A, n Output: index // location of x in A Binary search (x, A, n) { i = 1, j = n while ( i < j) m =int[(i + j)/2] if (x > A(m)) then i = m + 1 else j = m if x = A(i) then index = i else index = 0 }
  • 17. The Binary Search Search for 19 in the set A = {2,4,8, 9, 10, 13, 14, 16, 17, 19, 20, 21, 22, 26, 28, 31} Sorted list = {2, 4, 8, 9, 10, 13, 14, 16, 17, 19, 20, 21, 22, 26, 28, 31}, n = 16 2 4 8 9 10 13 14 16 17 19 20 21 22 26 28 31 Int[(15 + 1)/2] = 8th cell ↑ 16 < 19  1st set 2 4 8 9 10 13 14 16 17 19 20 21 22 26 28 31 Int[( 7 + 1)/2] = 4th cell ↑ 21 > 19  2nd set 2 4 8 9 10 13 14 16 17 19 20 21 22 26 28 31 Int[(4 + 1)/2] = 2nd cell ↑ 19 = 19  index found It took 3 steps for index found (same as n). It could have been as much as 4 and as little as 3. The worst case seems to be int(n+1/2) steps to find x. Therefore, a binary search is quicker in loop search then a sequential search.
  • 18. P/V - Algorithm Analysis
  • 19. P/V - Algorithm Analysis
  • 20. P/V - Algorithm Analysis