GDSFGD
GDSFGD
GDSFGD
1. Using rules of interferences, show that the hypothesis “If you send me an
email message, then I will finish writing the program,” “If you don’t send
me an email message then I will go to sleep early,” and if I go to sleep
early then I will wake up feeling refreshed” lead to the conclusion “If I do
not finish writing the program, then I will wake up feeling refreshed.” You
are required to show each step and give reasons for those steps before
you come to desired conclusion from the hypothesis.
Ans.:
Let p be the proposition “you send me email message”, q be the
proposition “I will finish writing the program”, the proposition “I will go to
sleep early”, and the proposition “I will wake up feeling refreshed.”
Then, the hypothesis is p q, ┐ p r, and r s.
The desired conclusion is ┐ q s.
We need to give a valid argument with hypothesis p q.
┐ p r, and r s and conclusion ┐ q s.
This argument from shows that the hypothesis p leads to the desired
conclusion.
Step Reason
I. p q Hypothesis
II. ┐q ┐p Contrapositive of (1)
III. ┐p r Hypothesis
IV. ┐q r Hypothetical syllogism using (ii) and (iii)
V. r s Hypothesis
VI. ┐q s Hypothetical syllogism using (iv) and (v)
2. Use mathematical induction
Prove that
3 + 3.5 + 3.52 +………+ 3.5n =
3(5n+1- 1)/4
Whenever n is a nonnegative
number.
Ans.:
Let p(n) be the proposition that
3 + 3.5 + 3.52 +………+ 3.5n = 3(5n+1- 1)/4 for the integer n.
Basis step: p (0) is true because 3.50=3=3(51 – 1)/4. This complete the basis
step.
Inductive step: for the inductive hypothesis, we assume that p(k) is true. That
is, we assume that 3 + 3.5 + 3.52 +………+ 3.5k = 3(5k+1- 1)/4
To carry out the inductive step using this assumption, we must show that
when we assume that p(k) is true, then p(k+1) is also true. That is, we must
show that
T S Q TvQ ┐Q (TvQ) ┐Q
F F F F T T
F F T T F F
F T F T T T
F T T T F F
T F F T T T
T F T T F F
T T F T T T
T T T T F F
Table 3.1
0 0
1 0
q2 q2
1 1
S/I A B
>q0 q1 q0
q1 q1 q1
q2 q0 q2
Table 4.1
Transition diagram:
bb bb bb
a a
q0 q1 q2
oo oo oo
Fig.4.1
Ans.: b b
σ a c b f
Fig.5.1
Now, converting the above Non-Deterministic Finite State Automata to
Deterministic Finite State Automata.
Σ/t a B
Σ c σ
c ɸ {c, f}
{c, f} ɸ {c, f}
Hence the required state diagram is:
b b
σ a c a {c, f}
a a
ɸ
Fig.5.2
Ans.:
Here, the given relation is a linear non-homogeneous recurrence relation.
So, it's solution exists in two parts i.e. homogeneous solution and particular
solution.
an = H.S + P.S = anh + anp
For homogeneous solution:
The homogeneous part: an = 7an-1 -16an-2 + 12an-3
Thus, the characteristic equation for the homogeneous part is:
r3 = 7r2 -16r + 12
or, r3 -7r2 -16r + 12 = 0
or, r3 - 3r2 -4r2 + 12r +4r – 12 = 0
or, r2(r-3) – 4r(r-3) +4(r-3) = 0
or, (r-3)(r2 -4r+4) = 0
or, (r-3)(r-2)(r-2) = 0
. .. r = 2,2,3
Now, the solution of homogeneous part of given recurrence relation is
anh = α13n + (α2 + nα3)2n ……………………………………………… (1)
to find the values of constants α1, α2 and α3, we use the initial conditions;
a0 = -2 = α1 + α2
or, α1 = -( α2 + 2) …………………………………………………………… (2)
a1 = 0 = 3 α1 + 2(α2 + 1* α3)20
or, 3 α1 + 2(α2 + α3) = 0 ……………………………………………………. (3)
solving eqns (2) and (3) we get,
α2 = 2(α3 - 3) …………………………………………………………………… (4)
we have, a2 = 5 = 32α1 + (α2 + 2 α3)22 ………………………………. (5)
solving (2) and (5) we get,
-5 α2 + 8 α3 = 23 ………………………………………………………. (6)
Solving (4) and (6) we get,
α3 = 7/2
now, from (4) we have,
α1 = -( α2 + 8) = -(1+2) = -3
thus, homogeneous solution is
anh = -3*3n + (1+ 7n/2)2n ………………………………………………… (7)
again, for particular solution:
let the trial reasonable solution be
anp = (Cn +D)4n
we have from recurrence relation,
(Cn + D) 4n = 7{C(n-1) + D}4n-1 -16{C(n-2) +D}4n-2+ 12{C(n-3) + D}4n-3 +n4n
(Cn + D) = 7/4*(Cn-C + D) -16/42*(Cn -2C + D) + 12/43*(Cn-3C + D} + n
16(Cn + D) = 28(Cn-C + D) -16(Cn -2C + D) + 3(Cn-3C + D} +16n
Cn + 5C + D – 16n = 0
n(C-16) + (D +5C) = 0
comparing coefficient on both sides, we get,
C = 16
So, D = -5C = -15 * 16 = -80
Thus, particular solution is,
anp = (Cn + D)4n = (16n - 80) 4n
Hence, the required solution of given recurrence relation is,
an = -3n+1 + (1 + 7n/2)2n + (16n - 80) 4n
7. Use Dijkstra’s algorithm to find the length of the shortest path between the
vertices a and z in the weighted graph displayed below.
b 3 d 4
4
4 z
a
1
5 2
3
c e
Fig.7.1
Ans.:
b 4 (a, b) d 7 (a, b, d)
3
4 4
a 4 z 10 (a, b, d, e, z)
1
5 2
3
c e 8 (a, b, d, e)
Fig.7.2
Here, we can use the Dijkstra’s algorithm to calculate the shortest path from
a to z.
Step 1: Calculating the possible adjacent nodes from ‘a’ i.e:
a b = 4 i.e. 4(a, b) (selected)
a c = 5 i.e. 5(a, c)
Step 2: Possible nodes from ‘b’ are:
bd =3 i.e. abd =7 (selected)
b e = 4 i.e. abe = 8
Step 3: Possible nodes from ‘d’ are:
dz =4 i.e. abdz = 11
dz =1 i.e. abde =8 (selected)
Step 4: Possible nodes from ‘e’ are:
ez =2 i.e. abdez =10 (selected)
Hence, the shortest path using the Dijktra’s algorithm is:
abdez with minimum weight 10 as shown in figure above.
8. Draw the figure for the complete bipartite graph K4,5 and the cycle graph with
6 vertices (this is usually denoted by C6). What is the chromatic number of the
drawn complete bipartite graph K4,5 and the cycle graph C6.
Ans.:
a b
f c
e d
Fig.8.1
9. Define a tree and discuss its various properties as well as application of trees.
Ans.:
Tree:
A tree is a connected undirected graph with no simple circuits. Because a
tree cannot have a simple circuit. A tree cannot contain multiple edges or
loops. Therefore, any tree must be a simple graph.
Properties of tree:
1. A tree with n vertices has n-1 edges.
2. A full m - ary tree with I interval vertices contains n=mi + 1 vertices
3. A full m – ary tree with
a. N vertices has I = (n – 1)/m internal
vertices and l = [(m – 1) n + 1]/mi + 1 leaves.
b. l internal vertices have n = mi + 1 vertices
And l = (m – 1) i + 1 leaves,
c. lleaves has n = (ml – 1)/ (m – 1) vertices
and I = (l – 1)/ (m – 1) internal vertices.
4. There are at most mn leaves in any m – ary of height h.
Application of trees:
2. Decision Tree:
Rooted trees can be used to model problems in which series of decisions
leads to a solution. For instance, a binary search tree can be used to locate
items based on a series of comparisons, where each comparison tells us
whether we should go right or left in a subtree. A rooted tree in which each
internal vertex corresponds to a decision, with a subtree at these vertices for
each possible outcome of the decision, is called a decision tree.
3. Game Tree:
Trees can be used to analyze certain types of games such as tic-tac-toe, nim,
cheekers, and chess. In each case of these games, two players take turns
making moves. Each player knows the moves made by the other player and
no element of chance enters into the game. We model such game using
game trees; the vertices of these trees represent the position that a game
can be in as it progresses: the edges represent legal moves between these
positions. Because game trees are usually large, we simplify game trees by
representing all symmetric positions of a game by the same vertex.
i. Eulerian graph
“For any network, the maximum of all flow values (i.e., the value of the
maximum flow), is equal to the minimum of all cut capacities (i.e. capacity
of the minimum cut).
a. Planer graphs:
A graph is called planar if it can be drawn in the plane without any
edges crossing (where a crossing of edges is the intersection of the
lines or arcs representing them at a point other than their common
end point). Sech a drawing is called a planar representation of the
graph.
Example:
Fig.10.1
b. Regular Graph:
A simple graph is called regular graph if every vertex of this graph has
the same degree. A regular graph is called n – regular if every vertex
in this graph has degree n.
Example:
Degree = 4
Fig.10.2
Degree = 2
Fig.10.3
Degree = 3
Fig.10.4