Professional Documents
Culture Documents
1603-ADA-2nd Internals+ Answer Key
1603-ADA-2nd Internals+ Answer Key
SCHOOL OF ENGINEERING
CO1: Analyse a given algorithm and express its worst, best and average time and space complexities in
asymptotic notations..
CO5: Design efficient algorithms using Backtracking and Branch and Bound Techniques for solving
problems.
CO6: Familiarize some approximation algorithms and the benefit of using them.
CO7: Classify computational problems into P, NP, NP-Hard and NP-Complete complexity classes.
Part A (Answer All Questions) (5x 4 = 20) PO
I. a. What is meant by amortized analysis.? CO1 1,2,3
b. Discuss the properties of RBT. CO1 1,2,3
c. Differentiate Binomial heap and Fibonacci heap CO1 1,2,3
d. What are approximation algorithms.? CO6 3,10
e Describe about PRAM models.?Give an example. CO6 3,10
Bloom’s taxonomy levels(L1-Remember, L2-Understand, L3-Apply, L4-Analyze L5-Evaluate L6-Create),PO-Program
outcome
Answer Key
I.
a) Amortized analysis -1 mark
There are three main techniques used for amortized analysis: .( 1 mark each)
The aggregate method, where the total running time for a se-
quence of operations is analyzed
The accounting (or banker's) method, where we impose an extra
charge on inexpensive operations and use it to pay for expensive opera-
tions later on.
The potential (or physicist's) method, in which we derive a po-
tential function characterizing the amount of extra work we can do in
each step. This potential either increases or decreases with each suc-
cessive operation, but cannot be negative.
b) Properties of RBT .( 1 mark each)
A red-black tree must satisfy these properties:
1. The root is always black.
2. A nil is recognized to be black. This factor that every non-NIL node has two
children.
3. Black Children Rule: The children of any red node are black.
4. Black Height Rule: For particular node v, there exists an integer bh (v) such that
specific downward path from v to a nil has correctly bh (v) black real (i.e. non-nil)
nodes. Call this portion the black height of v. We determine the black height of an
RB tree to be the black height of its root.
c)
A binomial tree of order 0 has 1 node only. We can construct a binomial tree of k order by taking
two binomial trees of order k-1 and making one tree as the leftmost child or other. Fibonacci Heap:
Fibonacci heap is a collection of trees that follows the property of min heap or max heap. Fibonacci
heaps can have any shape even if all trees can have a single node. In Fibonacci heaps, we’ll
maintain a pointer to a minimum value i.e. root of the tree.
All tree roots are connected using a circular doubly linked. Therefore, we can access all of them
using a single pointer.
( 1 mark each):
binomial heaps use a singly linked circular link list and fibonacci heaps use a doubly linked
circular linked list.:
Data members in a node for binomial heaps are data, link, degree, child. whereas in
fibonacci heaps it is data,parent, childcut, child, link, degree.
every binomial heaps is a fibonacci heaps but every fibonacci heaps is not a binomial heaps.
operations delete, decrease key and cascading cut are extra that can be performed in the
fibonacci heaps including those in the binomial heaps. i.e. deletemin, insert.
deletemin in binomial heaps involves the combining of trees where as deletemin or delete
in fibonacci heaps is performed without joining the trees obtained after deletion.
d) The goal of the approximation algorithm is to come as close as possible to the optimal solution in
polynomial time. Such algorithms are called approximation algorithms or heuristic algorithms.
The features of the Approximation Algorithm as follows. ( 1 mark each):
An approximation algorithm guarantees to run in polynomial time though it does not
guarantee the most effective solution.
An approximation algorithm guarantees to seek out high accuracy and top quality
solution(say within 1% of optimum)
Approximation algorithms are used to get an answer near the (optimal) solution of an
optimization problem in polynomial time