2marks DAA
2marks DAA
2marks DAA
6. List the factors which affect the running time of the algorithm.
Factors affecting the running time of an algorithm include
● Input size
● Algorithm complexity
● Hardware and system architecture
● Compiler optimizations
● Data structure efficiency
● Implementation details.
Ln-2
1. What are the advantages of the Brute-force algorithm over other
algorithms?
● Simplicity and ease of implementation.
● Guaranteed solution if one exists.
● Applicable to a wide range of problems.
3. Write the general plan for divide and conquer algorithm strategy.
Divide:
Break the problem into smaller subproblems of the same type.
Conquer:
Solve the subproblems recursively.
Combine:
Merge the solutions of the subproblems to form the solution to the
original problem.
4. Apply Master's Theorem to solve the following recurrence equation
T(n)=2T(n/2)+n,
T(1) = 1.
Ln-4&5
1. What is a bi-connected component?
A maximal subgraph where removing any single vertex does not disconnect
the graph.
● If we remove a vertex ,it remains connected and is known as
biconnected.
● Articulation point is zero.
●
2. Apply the sum of subset algorithm to construct the state space tree for the
set S = {2, 5,4} and d=6
{2.4}=6
3. Classify the following problems as NP Hard or NP Complete.
Sum of Subset - NP Complete
Knapsack problem - NP Complete
Hamiltonian circuit problem - NP Complete
Assignment Problem - NP Hard
4. IfG is a forest with n vertices and k connected components, how many edges
does G have?
G is a forest with n vertices and k connected components,
No. of edges
E=n−k
10. Find the number of binary search trees that can be constructed using 5
keys.
The Catalan number 𝐶𝑛 is calculated using the formula:
C₅ = 142