You are given a graph G = (V, E) where the weights of the edges can have
only three possible values - 2, 5 and 7. Design a linear time , that is O(E + V) time algorithm to find the minimum spanning tree of G. Hint: Modify a known algorithm.
There are n galaxies connected by m intergalactic teleport-ways. Each
teleport-way joins two galaxies and can be traversed in both directions.
However, the company that runs the teleport-ways has established an
extremely lucrative cost structure: Anyone can teleport further from their
home galaxy at no cost whatsoever, but teleporting toward their home galaxy
is prohibitively expensive.
Judy has decided to take a sabbatical tour of the universe by visiting as
many galaxies as possible, starting at her home galaxy. To save on travel
expenses, she wants to teleport away from her home galaxy at every step,
except for the very last teleport home.
(a) Describe and analyze an algorithm to compute the maximum number of
galaxies that Judy can visit. Your input consists of an undirected graph G
with n vertices and m edges describing the teleport-way network, an
integer 1 <= s <= n identifying Judy’s home galaxy, and an array D[1 .. n]
containing the distances of each galaxy from s
(Greedy Algorithms) Suppose you are given n tasks J = {j1, j2, · · · jn}.
Each task J has two parts - a preprocessing phase which takes pi units and a main phase which takes fi units of time. There are n machines that can execute the main phases of the jobs in parallel. However, the preprocessing phases need to be executed sequentially on a special machine. The completion time of any schedule is the earliest time when all tasks have finished execution. Design a greedy algorithm which produces a schedule that minimizes the completion time.
When would best-first search be worse than simple breadth-first search?
Compute 0/1 Knapsack problem for Total weight= 15 using dynamic programming.
Profit 3 0 9 4
Weight 1 10 5 0
Find Subset – sum for the given weight w={2, 4,6,11,13,14,16,8,20,23,25,26}, where m=30.
Find Binomial Coefficient for 6C3 using dynamic programming approach and also explain in detail about complexity.
Find Binomial Coefficient for 6C3 using dynamic programming approach and also explain in detail about complexity.
Given a directed graph G with the set of edges E = { (1, 2), (2, 4), (4, 2) (4, 1)} what will be the set of edge of it transpose
Construct a LCS table for Input1=’Student name’ and Input2=’Hometown’. Also find the Length of LCS and Actual LCS. Construct LCS for both scenarios given below.
a). Take Input1—Vertical and Input2—Horizontal
b). Take Input2—Vertical and Input1—Horizontal