0% found this document useful (0 votes)
6 views

DISCRETE Assignment - 2

Uploaded by

amjadrimsha851
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

DISCRETE Assignment - 2

Uploaded by

amjadrimsha851
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

FAST- National University of Computer and Emerging Sciences, Karachi.

FAST School of Computing, Fall 2022


CS1005-Discrete Structures
Assignment # 2 (CLO-1)
Instructions: Max. Points: 100
1- This is hand written assignment.
2- Just write the question number instead of writing the whole question.
3- You can only use A4 size paper for solving the assignment.
_________________________________________________________________________________________

1. Determine whether the graph shown in figure i to iv has directed or undirected edges, whether it has multiple
edges, and whether it has one or more loops. Use your answers to determine the type of graph.

i) ii) iii) iv)


2. The intersection graph of a collection of sets A1, A2,…, An is the graph that has a vertex for each of these sets
and has an edge connecting the vertices representing two sets if these sets have a nonempty intersection.
Construct the intersection graph of these collections of sets.
i) A1 = {0, 2, 4, 6, 8}, A2 = {0, 1, 2, 3, 4}, A3 = {1, 3, 5, 7, 9}, A4 = {5, 6, 7, 8, 9}, A5 = {0, 1, 8, 9}
ii) A1 = {…,−4,−3,−2,−1, 0}, A2 = {…,−2,−1, 0, 1, 2,…}, A3 = {…,−6,−4,−2, 0, 2, 4, 6,…}, A4 = {…,−5,−3,−1, 1, 3, 5,…},
A5 = {…,−6,−3, 0, 3, 6,…}

3. (a) Find the number of vertices, the number of edges, and the degree of each vertex in the given undirected
graph.
Also find the neighborhood vertices of each vertex in given graphs.
i) ii)

(b) Determine the number of vertices and edges and find the in-degree and out-degree of each vertex for the
given directed multigraph.
i) ii)
4. (a) Suppose that a new company has five employees: Zamora, Agraharam, Smith, Chou, and Macintyre. Each
employee will assume one of six responsibilities: planning, publicity, sales, marketing, development, and
industry relations. Each employee is capable of doing one or more of these jobs: Zamora could do planning,
sales, marketing, or industry relations; Agraharam could do planning or development; Smith could do publicity,
sales, or industry relations; Chou could do planning, sales, or industry relations; and Macintyre could do
planning, publicity, sales, or industry relations. Model the capabilities of these employees using appropriate
graph.

(b) Suppose that there are four employees in the computer support group of the School of Engineering of a
large university. Each employee will be assigned to support one of four different areas: hardware, software,
networking, and wireless. Suppose that Ping is qualified to support hardware, networking, and wireless;
Quiggley is qualified to support software and networking; Ruiz is qualified to support networking and wireless,
and Sitea is qualified to support hardware and software. Use appropriate graph to model the four employees and
their qualifications.

5. Find which of the following graphs are bipartite. Redraw the bipartite graphs so that their bipartite nature is
evident. Also write the disjoint set of vertices.
i) ii)

iii)
iv)

6. Draw a graph with the specified properties or show that no such graph exists.
i) A graph with four vertices of degrees 1, 1, 2, and 3
ii) A graph with four vertices of degrees 1, 1, 3, and 3
iii) A simple graph with four vertices of degrees 1, 1, 3, and 3

7. a) In a group of 15 people, is it possible for each person to have exactly 3 friends? Explain. (Assume that
friendship is a symmetric relationship: If x is a friend of y, then y is a friend of x.)
b) In a group of 4 people, is it possible for each person to have exactly 3 friends? Why?

8. (a) Find the union of the given pair of simple graphs. (Assume edges with the same endpoints are the same.)
i)
ii)

b) How many vertices does a regular graph of degree four with 10 edges have?

9. For given pair (G, G’) of graphs. Determine whether they are isomorphic. If they are, give function g: V (G) →V (G/)
that define the isomorphism. If they are not, give an invariant for graph isomorphism that they do not share.
i)

ii)

iii)
iv)

10. Find the length of a shortest path between a and z in the


given weighted graph by using Dijkstra’s algorithm.

i)
ii)

11. Imagine that the drawing below is a map showing four cities and the distances in kilometers between them.
Suppose that a salesman must travel to each city exactly once, starting and ending in city A. Which route from city
to city will minimize the total distance that must be traveled?
i) ii)
12. (a) The following is a floor plan of a house. Is it possible to enter the house in room A, travel through every
interior doorway of the house exactly once, and exit out of room E? If so, how can this be done?

(b) The floor plan shown below is for a house that is open for public viewing. Is it possible to find a trail that
starts in room A, ends in
room B, and passes through
every interior doorway of the
house exactly once? If so,
find such a trail.

13. Find Hamiltonian circuits AND Path for those graphs that have them.
Explain why the other graphs do not.
i) ii)
iii)

14. a) Determine which of the graphs have Euler circuits. If the graph does not have an Euler circuit, explain why
not. If it does have an Euler circuit, describe one.
i) ii)
b)

Determine whether there is an Euler path from u to w. If the


graph does not have an Euler path, explain why not. If it does have an Euler path, describe one.
i) ii)

15. (a) Use an incidence matrix to represent the graph shown


below.
i) ii)

(b) Draw a graph using below given incidence matrix.

i) ii)

16. Use an adjacency list and adjacency matrix to represent the given graph.
i) ii) iii)
iv)

17. Consider the tree shown at right with root a.


i) What is the level of n?
ii) What is the level
of a?
iii) What is the height of this rooted
tree? iv) What are the children of n?
v) What is the parent of g? vi) What are the
siblings of j?
vii) What are the descendants of f? viii) What are the
internal nodes?
ix) What are the ancestors of z? x) What are the leaves?
18. Use Prim’s algorithm to find a minimum spanning tree starting from V0 for given graphs. Indicate the order in
which edges are added to form each tree.
i) ii)
19. Use Kruskal’s algorithm to find a minimum spanning tree for given graphs. Indicate the order in which edges are
added to form each tree.
i) ii)

20. (a) i) Build a binary search tree for the word’s banana, peach, apple, pear, coconut, mango, and papaya
using alphabetical order.
ii) Build a binary search tree for the word’s oenology, phrenology, campanology, ornithology,
ichthyology, limnology, alchemy, and astrology using alphabetical order.

(b) Represent these expressions using binary trees.


(i) (x + xy) + (x / y)
(ii) x + ((xy + x) / y)

21. Determine the order in which preorder, Inorder and Postorder traversal visits the vertices of the given
ordered rooted tree.
i) ii)

22. (a) How many edges does a tree with 10000 vertices have?
(b) How many edges does a full binary tree with 1000 internal vertices have?

(c)
How many vertices does a full 5-ary tree with 100 internal vertices have?

23. (a) Write these expressions in Prefix and Postfix notation:


i) (x + xy) + (x / y)
ii) x + ((xy + x) / y)

(b) i) What is the value of this prefix expression + – ↑ 3 2 ↑ 2 3 / 6 – 4 2


ii) What is the value of this postfix expression 4 8 + 6 5 – * 3 2 – 2 2 + * /

24. Answer these questions about the rooted tree illustrated.

i) Is the rooted tree a full m-ary tree?


ii) Is the rooted tree a Balanced m-ary
tree?
iii) Draw the subtree of the tree that
is rooted at
a) c. b) f. c) q.

25. Find a spanning tree for the graph shown by removing edges in simple circuits. Write down the removed edges.
(i)
ii)
iii)

26. Determine whether the


given graph is planar. If so,
draw it so that no edges cross.
(a) (b)

27. Let R be the following relation defined on the set {a, b, c, d}:
R = {(a, a), (a, c), (a, d), (b, a), (b, b), (b, c), (b, d), (c, b), (c, c), (d, b), (d, d)}.
Determine whether R is:
(a) Reflexive (b) Symmetric (c) Antisymmetric
(d) Transitive (e) Irreflexive (f) Asymmetric

28. List the ordered pairs in the relation R from A = {0, 1, 2, 3, 4} to B = {0, 1, 2, 3}, where (a, b) ∈ R
if and only if
a) a = b. b) a + b = 4. c) a > b.
d) a | b. e) gcd(a, b) = 1. f) lcm (a, b) = 2.

29. List all the ordered pairs in the relation R = {(a, b) | a divides b} on the set {1, 2, 3, 4, 5, 6}.
Display this relation as Directed Graph (digraph), as well in matrix form.

30. For each of these relations on the set {1, 2, 3, 4}, decide whether it is reflexive, whether it is symmetric,
whether it is antisymmetric, and whether it is transitive.
a) {(2, 2), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4)} b) {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)}
c) {(2, 4), (4, 2)} d) {(1, 2), (2, 3), (3, 4)}
e) {(1, 1), (2, 2), (3, 3), (4, 4)} f) {(1, 3), (1, 4), (2, 3), (2, 4), (3, 1), (3, 4)}

31. Determine whether the relation R on the set of all people is reflexive, symmetric, antisymmetric,
Asymmetric, irreflexive and/or transitive, where (a, b) ∈ R if and only if:

a) a is taller than b. b) a and b were born on the same day.


c) a has the same first name as b. d) a and b have a common grandparent.

32. Give an example of a relation on a set that is


a) both symmetric and antisymmetric. b) neither symmetric nor antisymmetric

33. Consider these relations on the set of real numbers: A= {1,2,3}


R1 = {(a, b) ∈ R | a > b}, the “greater than” relation,
R2 = {(a, b) ∈ R | a ≥ b}, the “greater than or equal to “relation,
R3 = {(a, b) ∈ R | a < b}, the “less than” relation,
R4 = {(a, b) ∈ R | a ≤ b}, the “less than or equal to “relation,
R5 = {(a, b) ∈ R | a = b}, the “equal to” relation,
R6 = {(a, b) ∈ R | a ≠ b}, the “unequal to” relation.

Find:
a) R2 ∪ R4. b) R3 ∪ R6. c) R3 ∩ R6. d) R4 ∩ R6.
e) R3 − R6. f) R6 − R3. g) R2 ⊕ R6. h) R3 ⊕ R5.
i) R2 ◦ R1. j) R6 ◦ R6.

34. (a) Represent each of these relations on {1 , 2 , 3 } with a matrix(with the elements of this set listed in
increasing order).
i) { (1 , 1), ( 1 , 2), ( 1 , 3) }
ii) { (1 , 2), ( 2 , 1), ( 2 , 2) ,( 3 , 3) }
iii) { (1 , 1), (1 , 2), ( 1 , 3) , ( 2 , 2), ( 2 , 3) ,( 3 , 3) }
iv) { ( 1 , 3), ( 3 , 1) }

(b) List the ordered pairs in the relations on {1 , 2 , 3 } corresponding to these matrices(where rows and
columns correspond to the integers listed in increasing order).

(i) [1 0 1 0 1 0 1 0 1 ] (ii) [0 1 0 0 1 0 0 1 0 ] (iii) [1 1 1 1 0 1 1 1 1 ]

35. (a) Suppose that R is the relation on the set of strings of English letters such that aRb if and only if l(a) =
l(b), where l(x) is the length of the string x. Is R an equivalence relation?

(b) Let m be an integer with m > 1. Show that the relation R = {(a,b) | a ≡ b (mod m)} is an equivalence
relation on the set of integers.

36. (a) Find the first five terms of the sequence for each of the following general terms where n > 0.
𝑛
𝑛 3 (–1) 3𝑛+4
(i) 2 − 1 (ii) 10 − 2
𝑛 (iii) 2 (iv) 2𝑛−1
𝑛
(b) Identify the following Sequence as Arithmetic or Geometric Sequence then find the indicated term.

(i) -15, -22, -29, -36, …...; 11th term. (ii) a - 42b, a - 39b, a - 36b, a - 33b, ….; 15th term.
9
(iii) 4, 3, 4
, . . ..; 17th term (iv) 32, 16, 8, ….; 9th term
37. (a) Find the G.P in which:
1 64
(i) T3 = 10 and T5 = 2 2
(ii) T5 = 8 and T8 = − 27

(b) Find the A.P in which:


(i) T4 = 7 and T16 = 31 (ii) T5 = 86 and T10 = 146

38. (a) How many numbers are there between 256 and 789 that are divisible by 7? Also find their sum.
2
1 𝑛 −𝑛+1
(b) Find the sum to n terms of an A.P whose first term is 𝑛
and the last term is 𝑛
.

39. (a) Use summation notation to express the sum of the first 100 terms of the sequence {aj }, where
1
aj = for j = 1, 2, 3….
𝑗

(b) What is the value of:


8 5
𝑘 2
(i) ∑ (− 1) · (ii) ∑ (𝑗) ·
𝑘=4 𝑗=1

40. Find the first six terms of the sequence defined by each of these recurrence relations and initial conditions.
a) an = −2an−1, a0 = −1 b) an = an−1 − an−2, a0 = 2, a1 = −1
c) an = 3a2n−1, a0 = 1 d) an = nan−1 + a2n−2, a0 = −1, a1 = 0

41. As we have discussed, the practical application of all the topics in the class. Now you are required to submit
at least two real world applications of the following topics.

(a) Propositional Logic


(b) Predicates and quantifiers
(c) Sets
(d) Functions
(e) Relations
(f) Sequence and Series
(g) Graph theory
(h) Trees

BEST OF LUCK ☺

You might also like