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

Algo final (1)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Algo final (1)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

go

OVA2+ E), as the problem asked for efficlent algorithmI will


with Dijkstra algorithm.

Question 5 8/8 pts

1.(2 Points) DesCribe P and NP Problems with Example.


2. (2 Points) Find the GCD of 30, 36, 24.
3.(2 Points) Defne Supervised Learning and Unsupervised
Learning.
4.(2 Points)Defne (n)-approximation algorithm for n Size input.
solution cost of approximation algorithm.

Your Answer:

1. P problem is the problem that can be solved in polynomial time.


Example Merge sort, Quick sort
Amap contains major cities and the highways between them.
Assume the uniqueness of a highway directly connecting two major
cities with distance information.
1.2 Points) Abstractthis map as a weighted graph G(nodes and
edges) with w (weights)
2. (2 Points) Describe (no pseudo code) an efficient algorithm tofind
the shortest distances from a given city stoother major cities.
What is the time complexity?

Your Answer:
1.Assume the map has 3 vertices V= (Tampa, Miami, Orlando} E=
[Tampa. Miami).(Tampa, Miami).(Orlando, Tampal]and edges
w(Tampa, Miami) 250,w(Miami, orlando),=350,w (Orlando,
Tarnpa)- 480

75°F Mostl
1.(2 Points) Definea greedy algorithmn and what are the 6steps
used to develop agreedy algorithm.
2.(2 Points) What is the difference between greedy and dynanic
programming. Explain using 0-1 knapsack problern and fractional
knapsack problem.
3.(2 Points) Prove that the fractional knapsack problem has the
greedy choice property.

Your Answer:
1. Greedy algorithmobtains an optimal solution to a problem by
making sequence of choices. Six steps used to develop greedy
algorithm:
a. Determine the optimal substructure of the problem.
b. Develop the recursive solution.
1. (2 Points) Define what is an articulion point.
2. (2 Points) For the following graph, list the articulation
points.
3. (2 Points) List the bi-connected
components of the graph.

8
9

Your Answer:
Ouestion I 11/ll DS
ptS

Given a directed weighted graph G= (V.E), in which V=(v1, v2, V3,


V4, V5, V6,VT}, E- (v1,v2), (v1.,v3), (v2,v3), (v2,v4), (v3,v5), (v4,v6).
(v5,\7), (v6,v1), (v7,v1))
And

wv1,v2) =2, w(v1,v3) =6, wv2,v3) 8, w{v2,v4) = 5, w(v3,v5) 3,


wiv4,vó) =2, w(v5,v7) = 4, w(v6,v1)= 7, w\v7,v1)=1
11 Point) Draw this directed weighted graph.
2.12 Points) List the nodes visited in the order of using BFSG, v1),
3.12 Points) List the nodes visited in the order of using DFSG).
4.(2 Points) Can topological sorting be performed on this graph? If
yes, how it can be performed? If no, what is the problem?
5.(2 Points) Using an undirected graph for question 1,list the edges
is the order selected in the MST using Prim's algorithm
starting
from theroot v1.
6. (2 Points) Using an undirected graph for question 1,
list the edges
in the order selected in the Mininmum
SpanningTreeusing
Kruskal's algorithm,
Your Answer:

You might also like