You are on page 1of 2

Q: Write an algorithm to compute the next multiple of 8 for a given

positive integer using bitwise operators.


Example,
(a) For the number 12, the next multiple of 8 is 16.
(b) For the number 16, the next multiple of 8 is 24.

Q.For the data flow graph G= (V,E),I have to determine a partition - in


such a way that
sub graphs created could be computed in parallel and the sub graphs
are approximately of the same size
(sqrt(|V|))
For example as in graph -B0,B1,B2 - describe partially
the partition. Design algorithm for this ?

Q.Solve the following recurrences by tight Θ-notation bounds.assume that for n<=10,T(n)=O(1).
a. T(n)=3T(n/3)+0.5nlog(n).
b.T(n)=9T(3√n)+Θ (log(n))
c. T(n)=T(n)=T(2n/7)+ T(5n/7)+(n)

Q.Assume you have an array A[1:n] of n elements.A majority element of a is any element
occuring in more than n/2 positions(so if n=6 or n=7, any majority element will occur in at least 4
positions).assume that elements cannot be ordered or sorted, but can be compared for equality.
(you might think of elements as chips ,and there is a tester that can be used to determine whether
or not chips are identical)
Design an efficient algorithm to find a majority element in A(or determine that no majority
element exists).
May this problem be design in O(n) time?if yes,how?

Q.Given two sets A and B of n integers ,give an efficient deterministic algorithm to find A∩B
and analyze its runtime.can you implement this with randomization.if yes,how?

QSuppose you have N strings that can be generated on-the-fly, and you
wanted to discover if a hash function generates any collisions. Is
there a way to do this without O(N) storage?how?

Q.A table composed of N*M cells,each having a certain quantity of apples, is given. you start
from the upper-left corner. At each step you can go down or right one cell.Design an algorithm to
find the maximum number of apples you can collect ,if you are moving from upper-left corner to
bottom-right corner.

Q.There are n horses who have a transitive relation in terms of their speed (If A runs faster than B
and B runs faster than C => A runs faster than C). We don’t have space to conduct a race of all
the n horses. We can at most run 4 horses in a race. At least How many races do we need to have
to find the two fastest horses?The question can be asked in binary mode as well, i.e we can only
run two horses at a time. How many comparisons do we need to make?

Q.write short notes on any four:


1.Kruskal algorithm
2.NP-complete & NP-hard problem
3.Master theorem
4.Non-linear data structure
5.Dynamic programming

You might also like