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

Assignment # 2

Uploaded by

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

Assignment # 2

Uploaded by

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

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

FAST School of Computing, Fall 2024


CS1005-Discrete Structures
Assignment # 2
Instructions: Max. Points: 100
1- This is hand written assignment. You must submit the hard copy on 23th October 2024 in your class along with the
scanned copy on Google classroom.
2- Just write the question number instead of writing the whole question.
3- You can only use A4 size paper for solving the assignment.
4- You have to write your student ID and section on the top and your signature on the bottom of each page.

1. Consider 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.
i) List them in ordered pairs. ii) Show the above relations using matrix form.
iii) Draw the directed graph (Digraph). iv) Find the inverse of the above relations.

2. i) 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. Determine whether the relation R is an
Equivalence or Partial Order Relation.

ii) Give an example of a relation on a set of Whole Numbers that is:


a) both symmetric and antisymmetric. b) neither symmetric nor antisymmetric.
c) both symmetric and transitive d) neither Symmetric nor transitive

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

ii) 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)}

4. i) 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.
ii) Determine whether the relation R on the set of all Web pages is reflexive, symmetric, and/or transitive, where
(a, b) ∈ R if and only if:
a) Everyone who has visited Web page a has also visited Web page b.
b) there is a Web page that includes links to both Web page a and Web page b.

5. i) 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.

1
ii) Consider these relations on the set of integers:
R1 = {(a, b) ∈ R | a ≤ b}; R2 = {(a, b) ∈ R | a > b},
R3 = {(a, b) ∈ R | a = b or a = −b}; R4 = {(a, b) ∈ R | a = b},
R5 = {(a, b) ∈ R | a = b + 1}; R6 = {(a, b) ∈ R | a + b ≤ 3},
Which of these relations contain each of the pairs: (1, 1), (1, 2), (2, 1), (1, −1), and (2, 2)?

6. i) Determine whether the relations for the directed


graph R and S are reflexive, symmetric, antisymmetric,
and/or transitive.
ii) Draw the digraph for relation R-1 and S-1.
iii) Draw the digraph for relation R-1oS-1 and S-1oR-1.

7. 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.
c) Prove that the relation R is an equivalence type in the set P= {3, 4, 5,6} given by the relation R= {(p, q): |p – q| is even}.
d) Consider A = {2, 3, 4, 5} and R = {(5, 5), (5, 3), (2, 2), (2, 4), (3, 5), (3, 3), (4, 2), (4, 4)}. Show that the relation is an
equivalence relation.

8. a) Show whether the relation R = {(x, y) ∈ R, if, x ≥ y} defined on the set of positive integers is a partial order relation.
b) Show that the relation 'Divides' defined on Natural numbers is a partial order relation.
c) Consider A = {2, 3, 4, 5} and R = {(5, 5), (5, 3), (2, 2), (2, 4), (3, 5), (3, 3), (4, 2), (4, 4)}. Show that the relation is a partial
order relation.
d) 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 a partial order relation?

9. a) Find the first five terms of the sequence for each of the following general terms where n > 0.
𝟑 (–𝟏)𝒏 𝟑𝒏+𝟒
i) 𝟐𝒏 − 𝟏 ii) 𝟏𝟎 − 𝒏 iii) iv)
𝟐 𝒏𝟐 𝟐𝒏−𝟏
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.
𝟗
iii) 4, 3, 𝟒 , . . ..; 17th term iv) 32, 16, 8, ….; 9th term

10. a) Find the G.P in which:


i) T3 = 10 and T5 = 2 1/2 ii) T5 = 8 and T8 = -64/27
b) Find the A.P in which:
i) T4 = 7 and T16 = 31 ii) T5 = 86 and T10 = 146
c) How many numbers are there between 256 and 789 that are divisible by 7? Also find their sum.
𝟏 𝒏𝟐 −𝒏+𝟏
d) Find the sum to n terms of an A.P whose first term is 𝒏 and the last term is 𝒏
.

𝟏
11. a) Use summation notation to express the sum of the first 100 terms of the sequence {aj }, where aj = 𝒋̅ for j = 1, 2, 3….
b) What is the value of:
i) ∑𝟖𝒌=𝟒(−𝟏)𝒌 ⋅ ii) ∑𝟓𝒋=𝟏(𝒋)𝟐 ⋅
c) Find the first six terms of the sequence defined by each of these recurrence relations and initial conditions.
i) an = −2an−1, a0 = −1 ii) an = an−1 − an−2, a0 = 2, a1 = −1
iii) an = 3a2n−1, a0 = 1 iv) an = nan−1 + a2n−2, a0 = −1, a1 = 0
d) What are the terms a0, a1, a2 and a3 of the sequence {an}, where an equals?
i) (-2)n ii) 3 iii) 7 + 4n iv) 2n + (-2)n

2
12. a) A batsman hits the ball in the air after reaching the maximum height, ball dropped 40 feet during the 1st Second, 33
feet during the 2nd Second, and 26 feet during the 3rd Second, and so on. How many feet the ball dropped in 5th Second.
Also find the total distance covered by the ball after 5th second.
b) If the population of a town increases geometrically at the rate of 7% annually and the present population is 70000.
What will be the population after 6 years from now?

13. i) Determine whether the graph shown in figure a to d 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.

ii) 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.
a) 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}
b) 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, …}

14. 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)

c) Consider the multigraphs and find the following.


i) Which of them are connected? If a graph is not connected, find its connected components.
ii) Which is/are cycle-free (without cycles)? iii) Which is/are loop-free (without loops)?
iv) Which is/are (simple) graphs?

3
15. i) 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.

ii) 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.
a) b) c) d)

iii) Which of the graphs below are bipartite? Justify your answers.

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

b) 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.

c) Answer the following.


i) 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.)
ii) In a group of 4 people, is it possible for each person to have exactly 3 friends? Why?
iii) If 10 people each shake hands with each other, how many handshakes took place? What does this question have to
do with graph theory?
iv) Among a group of 5 people, is it possible for everyone to be friends with exactly 2 of the people in the group? What
about 3 of the people in the group?
v) How many vertices does a regular graph of degree four with 10 edges have?

4
17. i) 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.
a)

b)

c)

d)

ii) Given below are different graphs of Letters, identify which are the isomorphic to each other. Provide the invariant for
graph isomorphism that they share or do not share.

18. Find the length of a shortest path between node a and node z in the given weighted graph by using Dijkstra’s algorithm.
a)

5
b) c)

19. 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.

c) You are given the 10 pieces of domino set whose titles have the following set of dots:
(1,2); (1,3); (1,4); (1,5); (2,3); (2,4); (2,5); (3,4); (3,5); (4,5).
Discuss the possibility of arranging the titles in a connect series such that number on a title always touches the same
number on it neighbor. (Hint: Use a five vertex complete graph and see if it is a Euler Graph.)

20. a) Find Hamiltonian Circuits and Path for those graphs that have them. Explain why the other graphs do not.

b) Determine which of the graphs have Hamiltonian circuits and Path. If the graph does not have Hamiltonian Circuits
and Path, explain why not. If it does have Hamiltonian Circuit and Path, describe one.

6
c) 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) iii)

21. 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.

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.

22. a) Use an incidence matrix to represent the graph shown below.

b) Draw a graph using below given incidence matrix.

7
c) Use an adjacency list and adjacency matrix to represent the given graph.

d) Draw the graph represented by the given adjacency matrix.


(i) (ii)

23. a) Determine whether the given graph is planar. If so, draw it so that no edges cross.

b) Count the number of vertices V, the number of edges E, and the number of regions R of each graph given below
and also verify Euler’s formula.

24. i) Consider the tree shown at right with root a.


a) What is the level of n? b) What is the level of a?
c) What is the height of this rooted tree? d) What are the children of n?
e) What is the parent of g? f) What are the siblings of j?
g) What are the descendants of f? h) What are the internal nodes?
i) What are the ancestors of z? j) What are the leaves?

ii) 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?
d) How many leaves does a full 3-ary tree with 100 vertices have?
8
25. a) 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)

b) 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)

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

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

(b) Represent these expressions using binary trees.


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

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

9
b) Write these expressions in Prefix and Postfix notation:
i) (x + xy) + (x / y) ii) x + ((xy + x) / y)

c) 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 + * /

d) 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.

28. Consider a scenario from World War II where two Germen soldiers are communicating with each other through a secure
channel. Head of Platoon want to communicate two different messages to each of them through separate
communication channels. Both of them can received the message but can’t reply back. After receiving the message
from the head of platoon, these two soldiers communicate the received message to one of their subordinates each.
These subordinates can’t reply to them but have a one-way communication channel with the Platoon Head so that they
can confirm the message delivery to the head of platoon.
a) Transform the given scenario into a digraph.
b) Show the in-degree and out-degree of each vertex.
c) Using diagraph in part a), determine whether the relation is an equivalence relation OR a partial-order relation? Show
all of your steps.

29. Musab is an undergraduate student. The below graph map shows different path from his home to the school.

a) Musab wants to determine the shortest path from home to school using Dijkstra Algorithm. What will be the cost of
that path? Show all steps.
b) Determine the Euler Circuit and Path in the above graph for Musab? Show all of your steps with reasoning.
c) Determine the Hamilton Circuit and Path in the above graph for Musab? Show all of your steps with reasoning.

10
30. a) Determine if the following two graphs G and H as shown in figure# 1 & 2 are isomorphic. If they are, give function
f: V (G) → V (H) that define the isomorphism. If they are not, give the reason why?

G H

31. 32.

b) Consider the graphs G and H from part (a).


i) Is Graph G a complete Bipartite Graph? Explain.
ii) Determine if Euler and Hamilton circuits exist in Graph H. If yes, show the circuit, if not explain why?

31. 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. [10 points]
a) Relations
b) Sequence
c) Series
d) Graph theory
e) Trees

11

You might also like