Upload
samet
View
295
Download
3
Embed Size (px)
Citation preview
Discrete Mathematics
Final Homework
Samet Öztoprak
2601140342
May 6, 2015
1) Find the number of vertices, the number of edges, and the degree of each vertex in the given
undirected graphs. Identify all isolated and pendant vertices.
a)
Tips:
An isolated vertex is a vertex with degree zero.
A leaf vertex (also pendant vertex) is a vertex with degree one.
The number of vertices, the number of edges
Numbers
Vertices 6
Edges 6
The degree of each vertex
Node Degree of the vertex
a 2
b 4
c 1
d 0
e 2
f 3
isolated vertices d
pendant vertices c
b)
The number of vertices, the number of edges
Numbers
Vertices 9
Edges 12
The degree of each vertex
Node Degree of the vertex
a 3
b 2
c 4
d 0
e 6
f 0
g 4
h 2
ı 3
isolated vertices d,f
pendant vertices There is no pendant vertices.
2) Which graphs shown in Figure have an Euler path?
Tip:
An Euler path is a path that uses every edge of a graph exactly once.
An Euler path starts and ends at different vertices.
A B
CD
A
B C D
EFG
A B
C
DE
FG
Euler Path : BDABC Euler Path : DEFGABCDFCGB Euler Path : there is no euler path.
3) Which of the simple graphs in have a Hamilton circuit or, if not, a Hamilton path?
Tips:
In Hamilton paths and Hamilton circuits, the game is to find paths and circuits that include every
vertex of the graph once and only once.
A Hamilton path in a graph is a path that includes each vertex of the graph once and only
once.
A Hamilton circuit is a circuit that includes each vertex of the graph once and only once. (At the end, of course, the circuit must return to the starting vertex.)
Note that if a graph has a Hamilton circuit then it also has a Hamilton path.
A B
C
D
E
A B
CD
A B
CD E F
G
Hamilton circuit : BAEDCB Hamilton circuit : No Hamilton circuit : No Hamilton path : BAEDCB Hamilton path : DCBA Hamilton path : No
4) Draw the given planar graphs without any crossings.
a) b)
Tips:
A graph is planar if it can be drawn in two-dimensional space with no two of its edges
crossing. Such a drawing of a planar graph is called a plane drawing.
A B
5) Determine whether the given graphs are planar. If so, draw it so that no edges cross.
a) b)
a) No,it is not a planar graph.
b) Yes.
F
E
D
AC
B
6) Answer these questions about the rooted tree illustrated.
Question Answer Which vertex is the root a
Which vertices are internal a,b,c,d,f,h,j,g,q,t
Which vertices are leaves e,g,i,k,l,m,n,o,p,r,s,u
Which vertices are children of j q,r
Which vertex is the parent of h c
Which vertices are siblings of o p
Which vertices are ancestors of m f,b,a
Which vertices are descendants of b e,f,l,m,n
i)Is it a full m-ary tree for some positive integer m
Definition:
The tree is called a full m -ary tree if every internal vertex has exactly m children. Example : If m = 2, it is called a binary tree.
Accoring to definition f and d has 3 children therefore we can obviously say that
The tree is not full m-ary tree.
j)What is the level of each vertex of the rooted tree
Levels Vertex Level 0 a
Level 1 b,c,d
Level 2 e,f,g,h,i,j,k
Level 3 l,m,n,o,p,q,r
Level 4 s,t
Level 5 u
7) Find the output of the given circuit.
Output = (xy)' + (z'+x)
x y z (xy)' + (z'+x)
0 0 0 1
1 0 0 1
0 1 0 1
1 1 0 1
0 0 1 1
1 0 1 1
0 1 1 1
1 1 1 1
8) Let G = (V, T, S, P) be the phrase-structure grammar with V = {0, 1,A,B, S}, T = {0, 1}
and set of productions P consisting of
S → 0A => 𝑆1 → 0A
S → 1A => 𝑆2 → 1A
A → 0B => 𝐴1 → 0B
B → 1A => 𝐵1 → 1A
B → 1. => 𝐵2 → 1.
a) Show that 10101 belongs to the language generated by G.
𝑆2 1A
𝐴1 10B
𝐵1 101A
𝐴1 1010B
𝐵2 10101
10101 belongs to the language.
b) Show that 10110 does not belong to the language generated by G.
𝑆2 1A
𝐴1 10B
𝐵1 101A
There is no production A that will produce 1.
Therefore, 10110 in not in the language of G.
c) What is the language generated by G?
This means that the language is (0+1)01(01)∗.
9) Determine whether the string 01001 is in each of these sets.
a) {0, 1}*
{0,1}* is the set that contains all bit strings
Therefore ,01001 is in {0,1}*,
b) {0}*{10}{1}*
{0}*{10}{1}* is the set that allows consecutive 0s only beginnig of the string.
Therefore ,01001 is not in {0}*{10}{1}*,
c) {010}* {0}* {1}
01001 is equvalent to {010}* {0}* {1}
Therefore ,01001 is in {010}* {0}* {1}
d) {010, 011} {00, 01}
01001 is equvalent to {010}{01}
Therefore ,01001 is in {010, 011} {00, 01}
e) {00} {0}*{01}
{00} {0}*{01} is the set that requires the string to start with 00
Therefore ,01001 is not in {00} {0}*{01}
f ) {01}*{01}*
{01}*{01}* is the set that requires the string two 0s
Therefore ,01001 is not in {01}*{01}*
10) Find the language recognized by the given deterministic finite-state automaton.
We have two final states: s1.
State s1 can be reached using {1} and we stay in s1 as long as we have 0 or 1 as input.
Therefore language recognized by s1 is {1}{0,1}*
State s1 can be reached using {0}{1}*{0}{0,1}*
L(r) = { λ,1(0,1)*,01*0(0,1)*}
11) Describe inwords the strings in each of these regular sets.
a) 001*
b) (01)*
c) 01 ∪ 001*
d) 0(11 ∪ 0)*
e) (101*)*
f ) (0*∪1)11
Tips:
∅ represents the empty set, that is, the set with no strings;
λ represents the set {λ}, which is the set containing the empty string;
x represents the set {x} containing the string with one symbol x;
(AB) represents the concatenation of the sets represented by A and by B;
(A ∪ B) represents the union of the sets represented by A and by B;
A* represents the Kleene closure of the set represented by A.
a) Any number start by 00 followed by any number of 1s (including no ones)
b) Any number of copies of 01 (including the null string)
c) The string is 01 or the number start by 00 followed by any number of 1s
d) Any string start by 0 followed by any number of 11 or 0 (including empty)
e) λ or any number of copies of 10 followed by any number of 1s
f) Any number start by 1 or any number of copies of 0 that ends with 11