Important Questions

Important Questions

Foundation of Algorithm Analysis

Asked in 2082Short Question5 Marks
1.
State the time and space complexity for sequential search. Write the rules for master theorem for finding asymptotic bounds. [5]

Sequential Search — Complexity

Sequential Search (Linear Search) is a method that checks each element one by one until the target is found or the list ends.

Time Complexity:

  • Best Case: O(1)O(1) — element found at the first position
  • Worst Case: O(n)O(n) — element found at the last position or not present
  • Average Case: O(n)O(n)

Space Complexity: O(1)O(1) — no extra space is used (in-place search)


Master Theorem — Rules for Finding Asymptotic Bounds

The Master Theorem provides a direct solution for recurrences of the form: T(n)=aT(nb)+f(n)T(n) = aT\left(\frac{n}{b}\right) + f(n) where a1a \geq 1, b>1b > 1, and f(n)f(n) is an asymptotically positive function.

Let ccrit=logbac_{crit} = \log_b a, then the three cases are:

Case I: If f(n)=O(nc)f(n) = O(n^c) where c<logbac < \log_b a, then:

T(n)=Θ(nlogba)T(n) = \Theta(n^{\log_b a})

Case II: If f(n)=Θ(nc)f(n) = \Theta(n^c) where c=logbac = \log_b a, then:

T(n)=Θ(nlogbalogn)T(n) = \Theta(n^{\log_b a} \cdot \log n)

Case III: If f(n)=Ω(nc)f(n) = \Omega(n^c) where c>logbac > \log_b a, and if af(nb)kf(n)a \cdot f\left(\frac{n}{b}\right) \leq k \cdot f(n) for some k<1k < 1 (regularity condition), then:

T(n)=Θ(f(n))T(n) = \Theta(f(n))


Conclusion: Sequential search has linear time complexity, while the Master Theorem efficiently determines the asymptotic bound of divide-and-conquer recurrences by comparing f(n)f(n) with nlogban^{\log_b a}.

Asked in 2082Short Question5 Marks
2.
Solve the recurrence relation T(n) = 2T(n/2) + n using recursion tree method. [5]
Asked in 2081Short Question5 Marks
3.
Write short notes on: a) Big Oh, Big Omega, Big theta b) Class P, Class NP and NP-Complete [5]
Asked in 2081Short Question5 Marks
4.
State cooks theorem. Discuss about problem reducibility. [5]
Asked in 2081Short Question5 Marks
5.
Solve the following recurrence relations using master's method.
T(n)=2T(n2)+n3, n>1;T(n)=1, n=1T(n) = 2T\left(\frac{n}{2}\right) + n^3,\ n > 1;\quad T(n) = 1,\ n = 1
T(n)=2T(n4)+1, n>1;T(n)=1, n=1T(n) = 2T\left(\frac{n}{4}\right) + 1,\ n > 1;\quad T(n) = 1,\ n = 1
[5]
Asked in 2080Short Question5 Marks
6.
Write short notes on a) Aggregate Analysis b) Selection problems [5]
Asked in 2080Short Question5 Marks
7.
Define RAM model. Write down iterative algorithm for finding factorial and provide its detailed analysis. [5]
Asked in 2080Long Question10 Marks
8.
What is recurrence relation? How it can be solved? Show that time complexity of the recurrence relation T(n)=2T(n/2)+1T(n) = 2T(n/2) + 1 is O(n)O(n) using substitution method. [10]
Asked in 2079Short Question5 Marks
9.
Solve the following recurrence relations using masters method.
a. T(n)=2T(n/4)+kn2, n>1; T(1)=1\text{a. } T(n) = 2T(n/4) + kn^2,\ n > 1;\ T(1) = 1
b. T(n)=5T(n/4)+kn, n>1; T(1)=1\text{b. } T(n) = 5T(n/4) + kn,\ n > 1;\ T(1) = 1
[5]
Asked in 2079Short Question5 Marks
10.
Write short notes on: a) Best, Worst and average case complexity b) Greedy Strategy [5]
Asked in 2078Short Question5 Marks
11.
Explain the recursion tree method for solving the recurrence relation. Solve following recurrence relation using this method. T(n)=2T(n/2) +1 for n>1, T(n)=1 for n=1 [5]
Asked in 2078Long Question10 Marks
12.
What are the elementary properties of algorithm? Explain. Why do you need algorithm? Discuss about analysis of the RAM model for analysis of algorithm with suitable example. [10]
Asked in 2076Short Question5 Marks
13.
Solve the following recurrence relation using the master method. a. T(n)=7T(n/2)+n2T(n) = 7 T(n/2) + n^2 b. T(n)=4T(n/4)+knT(n) = 4 T(n/4) + kn [5]
Asked in 2076Long Question10 Marks
14.
What do you mean by the complexity of an algorithm? Explain the asymptotic notations used to describe the time/space complexity of any algorithm with their geometrical interpretation and example. [10]