18IS6C2
USN
RV COLLEGE OF ENGINEERING®
(An Autonomous Institution affiliated to VTU)
VI Semester B. E. Grade ImprovementExaminations November 2021
Information Science and Engineering
Advanced Algorithms (Elective)
Time: 03 Hours Maximum Marks: 100
Instructions to candidates:
Answer any FIVE full questions out of TEN. Each carries 20 marks
1 1.1 How does amortised analysis differ from Average case analysis of
algorithms? 02
1.2 Which of the asymptotic notation gives tight bounds? Comment. 02
1.3 The recurrence of an algorithm, where n is the input size, is given by
2 1 1, 1 0 0. What is the time complexity
of this algorithm? 02
1.4 How many solution/solutions are available for a graph having
negative weight cycle in Bellmann Ford algorithm? 01
1.5 How many times the for loop in the Bellmann Ford algorithmgets
executed on a graph , ? 01
1.6 Roots of all the trees in a Fibonacci heap are connected as a ____. 01
1.7 Any two properties a flow in a flow-network must satisfy ____ and ___. 02
1.8 Is Dijikstra’s algorithm is more efficient than Bellmann Ford
algorithm? Comment. 02
1.9 ______ string matching algorithm expects the text and pattern
character to be radix-d digits. 01
1.10 Working modulo q=13, how many spurious hits does the Robin-Karp
matcher encounter in the text T=90231415267399 and P=31415. 02
1.11 Draw a state transition diagram for a string-matching automation for
the pattern abb over the alphabet,{a,b}. 02
1.12 What is approximation ratio? 02
2 a Discuss recursion tree method to solve recurrences. Solve the
following recurrent equation using the same.
)+n. 10
b What is amortised analysis of an algorithm? Explain the Accounting
method for finding amortised cost for stack operations. The stack
operations include Push,Pop and Multipop. 10
3 a Explain with examples, the five different asymptotic notations. 10
b What is Master theorem? Compare it with substitution method. Solve
the following recurrence using both Master’s theorem as well as
substitution method
2 .
2 10
4 a Write an algorithm for counting sort and trace the same on the array
2,5,3,0,2,3,0,3. 10
b Write dynamic programming based algorithm to solve the matrix
chain multiplication problem. Solve the sequence of 6 matrices given
below
30x35,35x15,15x5,5x10,10x20,20x25. 10
5 a Write an algorithm for Bucket sort and give the analysis 10
b Write an algorithm to find the longest common subsequences of the
given two sequences. Trace the algorithm on the sequences.
X={A,B,C,B,D,A,B} and Y={B,D,C,A,B,A}. 10
6 a Write Johnson’s algorithm to compute all-pairs shortest paths and
analyse its efficiency.Discuss on the data structures and additional
sub-routines used in the Johnson’s algorithm. 10
b Write Ford-Fulkerson algorithm to solve maximum flow problem.
Apply the same on the following graph to find the maximum flow.
10
7 a Six students Asha(A), Balu(B), Chris(C), Dev (D),Elsa(E) and Fida(F)
are asked to help organize the school play. They must be assigned to
the following tasks: Wardrobe(W),Props(P), Tickets(T), Make-up(M),
Lighting(L) and Sound(S). The table shows which tasks each student
could help with .
Initially Asha,Babu, Chris and Dev are matched to the first job in the
table.
i. Draw a bipartite graph to model this scenario.
ii. Draw the initial matching on a new bipartite graph.
iii. Design the matching algorithm and use the same to find a
complete matching. 10
b In the given graph, vertices represent jobs and its edges represent
sequencing constraints;
Edge(u,v) would indicate that job u musts be performed before job v.
Modify the DAG-shortest paths procedure so that it finds a longest
path in a directed graph with weighted vertices in linear time.
Apply your algorithms to find the cost of longest path from vertex 7 to
all other vertices in the following graph.
10
8 a State and prove the Chinese remainder algorithm. 10
b Write the Extended Euclid algorithm and suing the same find
GCD(99,78). 10
9 a For string matching with finite automata, write the algorithm to
compute the transition function and the finite automation matcher.
Apply the same to construct the string-matching automation for the
patter P=aabab and illustrate its operations on the text string
T = aaababaabaababaab 10
b Write an algorithm to unite 2 Binomial –Heaps. Explain the different
cases of the algorithm with suitable examples. 10
10 a How detection of a key is achieved in case of binomial heap? Write the
algorithms and explain with suitable examples. 10
b Give the general structure of Fibonacci heap. Give the procedure to
insert a node into the given Fibonacci heap with examples. 10