Algorithms & Data Structures Question

Part 1: In your own words, answer the following:

  1. Illustrate what does O(log n) mean in terms of time complexity?
  2. Illustrate what does O(n log n) mean in terms of time complexity?

Investigate how the number of operations grows as the input size (n) increases

Part 2: Identify one algorithm with time complexity O(log n) and one algorithm with time complexity O(n log n)

For each algorithm:

  • Illustrate how the algorithm works
  • Illustrate why the algorithm has the specified time complexity

Part 3: Compare O(log n) and O(n log n) in terms of time?

Part 1

O(log n) Explanation

Clearly illustrates logarithmic growth (reducing input size) and correct relation to execution time

Part 1

O(n log n) Explanation

Clearly illustrates combined linear + logarithmic growth and relation to execution time

Part 2

O(log n) Algorithm Description

Clear and correct explanation of how the algorithm works

Part 2

O(log n) Time Complexity Justification

Clearly shows input reduction (e.g., halving) leading to O(log n)

Part 2

O(n log n) Algorithm Description

Clear and correct explanation of how the algorithm works

Part 2

O(n log n) Time Complexity Justification

Clearly identifies where n and log n come from

Part 3

Comparison & Justification

Correctly identifies O(log n) as more efficient with clear explanation based on growth of execution time

WRITE MY PAPER

Comments

Leave a Reply