Professional Documents
Culture Documents
5th May
Issue Date 14th March 2021 Week10 Submission Date
2021
Question No. √ √ √ √
• The entire project/case study/poster is designed and developed by me (and my team members).
• The proper citation has been used when I (and my team members) used other sources.
• No part of this project has been designed, developed or written for me (and my team members)
by a third party.
• I have a copy of this project in case the submitted copy is lost or damaged.
• None of the music/graphics/animation/video/images used in this project have violated the Copy
Right/Patent/Intellectual Property rights of an individual, company or an Institution. I have
the written permission from people who are featuring in this project.
Marks Obtained
1
Part 1 (CLO1): Logic and proof
Express English statements in logic using propositions and logical connectives.
¬P∧¬R
P R ¬P ¬R ¬P∧¬R
T T F F F
T F F T F
F T T F F
F F T T T
b) The only way to pass the course is to attend all classes and to take notes during class.
R↔(¬P∧Q)
P Q R ¬P (¬P∧Q) R↔(¬P∧Q)
T T T F F F
T T F F F T
T F T F F F
T F F F F T
F T T T T T
F T F T T F
F F T T F F
F F F T F T
2
c) If you missed many classes, then you did not take notes during these classes.
P→¬Q
P Q ¬Q P→¬Q
T T F F
T F T T
F T F T
F F T T
d) You might fail the course in case you missed many classes, or you did not take notes.
¬R →(P∨¬Q)
P Q R ¬Q ¬R (P∨¬Q) ¬R→(P∨¬Q
)
T T T F F T T
T T F F T T T
T F T T F T T
T F F T T T T
F T T F F F T
F T F F T F F
F F T T F T T
F F F T T T T
3
1- Algorithm 2- Python
4
1. Set a list. def mergeSort(array):
if len(array) > 1:
i=j=k=0
4. Call mergeSort for second half: while i < len(L) and j < len(M):
Call mergeSort(arr, m+1, r) if L[i] < M[j]:
array[k] = L[i]
i += 1
else:
5. Merge the two halves sorted in step 2 and
3: array[k] = M[j]
Call merge(arr, l, m, r) j += 1
k += 1
6. Print the sort.
while i < len(L):
array[k] = L[i]
i += 1
k += 1
def printList(array):
for i in range(len(array)):
print(array[i], end=" ")
print()
if __name__ == '__main__':
array = [1, -4, 14, -4, 34, 10, 7, -7, 34, 1]
mergeSort(array)
5
Part 3 (CLO3): Complexity of algorithm:
1- Calculate the total number of steps required by the algorithm, and express it as a
function of n (f(n) ).
2- Determine the Time complexity of the algorithm using Big-O notation.
6
Part 4 (CLO4): Structures:
1- Use Graph coloring to solve one of the following problems.
3- Analyze the following weighed graph and find the shortest path between two vertices.
7
Path Weight/cost
A→ G→ I→ J 210 + 253 + 209 = 672
A→E→F→J 235 + 174 + 480 = 889
A → V→ N → O → I → J 118 + 377 + 111 + 217 + 209 =
1032
A → V → N→ L→ K → J 118 + 377 + 251 + 192 + 123 =
1061
A→V→G→I →J 118 + 176 + 253 + 209 = 756
A → G → H→ E → F → J 210 + 98 + 115 + 174 + 480=
1077
4- Use Kruskal’s algorithm to construct the Minimum Spanning Tree (MST) for a graph.
8
edge dv edge dv
(7,8) 1 √ (1,9) 5 √
Total Cost = dv = 34