Module quiz: Introduction to algorithms :Coding Interview Preparation (Meta Front-End Developer Professional Certificate) Answers 2025
1. Insertion sort is an example of divide and conquer.
✔️ False
❌ True
2. Number of swaps for insertion sort on [6, 8, 19, 48, 9, 90]
Correct answer: ✔️ 2
(Only 9 needs to move past 48 and 19)
3. Time complexity of linear search
✔️ O(n)
❌ ((log n))
❌ O(1)
4. Why we need Big-O notation?
✔️ Because measuring time is relative to a person’s computer, so a relative metric is required.
❌ Sorting is complicated…
❌ Sorting requires…
5. What is parallelization?
✔️ Running code at the same time in threads or separate computers.
❌ Calling functions repetitively…
❌ Writing code in one go…
6. Why use recursion?
✔️ It lends itself well to divide and conquer.
❌ Reduces pressure on compiler…
❌ Looks cool…
7. Why memoization works with dynamic programming?
✔️ It stores previous subproblem results, reducing computation.
❌ Needs less compiling…
❌ Takes less hard drive space…
8. How are DP and greedy at odds?
✔️ DP computes optimal globally; greedy takes immediate best option.
❌ Agility vs slow…
❌ Greedy monopolizes CPU…
9. Why binary search is O(log n)?
✔️ Because the search space is halved at each step.
❌ It’s O(n)
❌ It sorts while searching
10. Fibonacci pseudocode — number of recursive instances
✔️ 2
❌ 1
❌ 0
📘 Summary Table
| Q | Correct Answer |
|---|---|
| 1 | False |
| 2 | 2 |
| 3 | O(n) |
| 4 | Relative metric needed (Big-O) |
| 5 | Parallel execution of code |
| 6 | Works well with divide & conquer |
| 7 | Stores subproblem results |
| 8 | DP = global optimum; Greedy = local choice |
| 9 | Halves search space each step |
| 10 | 2 recursive calls |