Unit summary
- An algorithm is finite, definite, effective and has input and output; analysis counts basic operations apriori.
- Time and space complexity depend on input size; worst case is the standard guarantee.
- O, Ω and Θ give upper, lower and tight bounds ignoring constants.
- Sequential search is Θ(n); bubble and selection sort are Θ(n²); insertion sort is Θ(n) to Θ(n²).
- Classical matrix multiplication is Θ(n³) with three nested loops.
- Recursive algorithms yield recurrences solved by expansion, trees or the Master theorem.
Glossary
| Term | Meaning |
|---|---|
| Algorithm | Finite sequence of steps solving a problem. |
| Apriori analysis | Counting steps before running the program. |
| Base case | Smallest instance solved directly. |
| Basic operation | The most frequently executed step. |
| Big-O | Upper bound on growth. |
| In place | Uses only O(1) extra memory. |
| Master theorem | Solves T(n) = aT(n/b) + f(n). |
| Omega | Lower bound on growth. |
| Recurrence | Equation for T(n) in terms of smaller inputs. |
| Recursion tree | Tree of calls used to sum the work. |
| Space complexity | Extra memory as a function of n. |
| Stable sort | Keeps equal keys in input order. |
| Theta | Tight bound on growth. |
| Time complexity | Basic operations as a function of n. |
Question bank
Short Answer Questions (2 marks each)
- Define an algorithm.
- What is a basic operation?
- Distinguish best, worst and average case.
- Define Big-O notation.
- What is Θ notation?
- How many comparisons does selection sort make?
- State the best case of insertion sort.
- What is a recurrence relation?
- Write the recurrence for merge sort.
- State Case 2 of the Master theorem.
Medium Answer Questions (5 marks each)
- Explain the properties of an algorithm.
- Explain O, Ω and Θ notations with examples.
- Analyse bubble sort for best and worst cases.
- Analyse insertion sort with an example.
- Analyse the classical matrix multiplication algorithm.
- Solve T(n) = 2T(n/2) + n by the recursion tree method.
Long Answer Questions (15 marks each)
- Explain time and space complexity and the three asymptotic notations with proofs of bounds.
- Analyse sequential search, bubble sort, selection sort and insertion sort for all cases.
- Explain recursion, write recurrences and solve them by substitution.
- State the Master theorem and solve five recurrences with it.
Sources
- Official BCA syllabus Design and Analysis of Algorithms, course code 26BCA404DS03, Unit I
