Skip to main content

Measures of efficiency with standard curves

Short answer

Efficiency is measured by time and space complexity vs. input size n. Standard growth orders include O(1), O(log n), O(n), O(n log n), O(n²), O(n³), and O(2ⁿ). Slower growth curves (e.g., log n) represent efficient algorithms; quadratic and exponential become impractical for large n.

Illustrate measures of efficiency of algorithm with standard curve and problem size.

The efficiency of an algorithm is measured by two things as a function of the problem size n:

  • Time complexity: number of basic operations (steps) executed.
  • Space complexity: extra memory needed.

Each is expressed by its growth rate with n. The standard orders of growth are:

OrderNamen = 10n = 100n = 1000Example
1Constant111array access
log₂ nLogarithmic3.36.610binary search
nLinear101001,000sequential search
n log₂ nLinearithmic336649,966merge sort
n²Quadratic10010,00010⁶bubble sort
n³Cubic1,00010⁶10⁹matrix multiplication
2ⁿExponential1,0241.3×10³⁰hugesubset enumeration

Curves (time against n):

 time
  |                       2^n
  |                     /  n^2
  |                   / /  n log n
  |                 / / / .  n
  |               / / /.'  .
  |             / / /.' .'
  |          _/_/_.-'.-'  ___ log n
  |  _____--''-----'------------ 1
  |________________________________ n

Slower-growing curves (1, log n, n) show efficient algorithms; steeply rising ones (n², 2ⁿ) become impractical for large n.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Structure and Algorithm chapter 9 questions →