0% found this document useful (0 votes)
49 views5 pages

DAA Question - Bank

The document contains practice questions from various algorithm analysis units including time complexity, algorithm design techniques, asymptotic notation, algorithm analysis types, recursion, sorting algorithms like merge sort and quick sort, matrix multiplication, backtracking, graph coloring, subset sum problem and more.

Uploaded by

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

DAA Question - Bank

The document contains practice questions from various algorithm analysis units including time complexity, algorithm design techniques, asymptotic notation, algorithm analysis types, recursion, sorting algorithms like merge sort and quick sort, matrix multiplication, backtracking, graph coloring, subset sum problem and more.

Uploaded by

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

 Unit 1 Practice Questions

 Explain what is time complexity of Algorithm? ...


 Elaborate different properties of algorithms.
 What are the various ways of expressing algorithms?
 Write an algorithm and draw a flowchart to convert the length in feet to centimeter.
 Explain different algorithm design techniques in detail.
 What is the difference between a flowchart and a pseudocode?
 Differentiate between divide and conquer technique and dynamic programming
technique.
 How does performance analysis play an important role in evaluating the efficiency of a
program? What are the factors involved in evaluating a program?
 Mention what are the types of asymptotic notation used for Time Complexity? ...
OR
 Describe the types of algorithm analysis in detail.
 What is the advantage of recursive approach than an iterative approach?
 Elaborate binary search algorithm using recursion along with its time complexity.
 Give the three cases of Master’s theorem.
 Explain heap sort algorithm with the help of following example:

 Apply max-heapify process on given elements {4,1,3,2,16,9,10,14,8,7} and build its


heap tree.

NOTE: All the above questions solutions are available in Unit 1 ppts

 Evaluate the space complexity of following programs:


a) float sum (float list[], int n)
{
float fTmpSum= 0;
int i;
for (i= 0; i< n; i++)
fTmpSum+= list[i];
return fTmpSum;
}
b) float abc(float a, float b, float c)
{
return a+b+b*c+(a+b-c)/(a+b)+4.00;
}

c) float rsum(float list[], int n)


if (n) return rsum(list, n-1) + list[n-1];
return 0;
}

 Evaluate the time complexity of the following programs:-


a) void add(int a[] [MAX_SIZE], …)
{
int i, j;
for (i=0; i < rows; i++)
for (j=0; j < cols; j++)
c[i][j] = a[i][j] + b[i][j];
}

b) int abc(int a, int b, int c)


{
return a + b + b + c *4.0;
}

c) float sum(float *list, int n)


{
float tempsum = 0;
for(int i=0;I < n;i++)
tempsum += *(list + i);
return tempsum;
}

d) float rsum(float *list, int n)


{
If (n > 0)
return rsum(list, n-1) + list[n-1];
else
return 0;
}

 Evaluate the total time required (i.e., O(n)) for execution of following program codes:
Total time = number of iterations * the running time of the statements inside the loop
a) for (int i = 0; i < = n; i++)
m = m + 1; //constant time c

b) for (int i = 0; i < = n; i++)


for(int j = 0; j <= n; j++)
m = m + 1; //constant time c

c) for (int i = 1; i < n; i * = 2)


m = m + 1;

 Determine which is better expression from complexity point of view using principle of
mathematical induction
.
(10n+10) vs (0.01n2+10)

 Determine the running time required for following recurrence relation. Use recursion tree
method for solving given relation.

T ( n )=4 T ( n2 )+ n n>1
NOTE: All the above problem based questions solutions are available in Unit 1 ppts

Unit 2 Practice Questions

 Explain in brief why complexity of Binary Search is O(log n)?


 Elaborate the binary search algorithm. Justify how does it follows divide and conquer
strategy.
 Explain whether it is possible to use binary search for linked lists? .
 Write pseudocodes for performing merging and merge sort.
 Explain Quick Sort algorithm with suitable example.
 Why worst-case complexity of quick sort is O(n2) ? Take an example and justify your
answer.
 Find product of following matrices using Strassen’s Matrix Multiplication algorithm.

A= [ ]
1 3
5 7
B= [ ]
8 4
6 2

NOTE: Some of the problem based questions solutions are available in Unit 2 ppts

Unit 3 Practice Questions

 Write any four applications of backtracking algorithmic approach.


 Observe the following problem statement,
Given a N*N board with the Knight placed on the first block of an empty board. Moving
according to the rules of chess knight must visit each square exactly once.
Which algorithmic approach can be used for solving above problem? Justify your
answer.

 Explain the 4 Queen problem using backtracking based algorithm and suitable example.
 What is a Hamiltonian Cycle. Define Hamiltanion path.
 Describe the graph colouring problem with the help of folloing example:

Give the possible 2-coloring and 3-coloring for graph G.

 Explain the 8 Queen problem using backtracking based algorithm and suitable example.
 Given n=6, Weights = {5,10,12,13,15,18} and M=30. Find all possible subsets for which
sum = M. Draw the generated state space tree.
NOTE: Some of the above problem based questions solutions are available in Unit 3
ppts

You might also like