liveBook · Manning

Logarithm

As explained in Grokking Data Structures

A logarithmic function grows proportionally to the logarithm of its input and therefore increases very slowly as input size grows.

A logarithmic function grows very slowly as its input increases. In algorithm analysis, this makes logarithmic growth an important benchmark for judging how running time scales with larger inputs. section 4.8 section 4.9

Compare logarithmic growth with other common growth rates:

  • Linear functions grow at a constant rate. section 4.8
  • Linearithmic functions grow faster than logarithmic functions but remain slower than polynomial functions. section 4.8
  • Polynomial functions accelerate rapidly, while exponential functions grow extremely fast as input size increases. section 4.8
  • Asymptotic formulas estimate an algorithm’s order of magnitude rather than its exact execution time. section 4.9
Some of the growth rates you might encounter when studying algorithms. From left to right, the functions grow increasingly faster.

Use the growth-rate figure to compare how logarithmic, linear, linearithmic, polynomial, and exponential functions increase. section 4.8

How long does it take to run an algorithm? That depends on the order of growth of its running time. All results are approximated.

Use the runtime figure to connect orders of growth with approximate execution times for algorithms operating on arrays. section 4.9

How Grokking Data Structures covers it

How deep it goes
Defines slow growth and compares growth classes, stopping short of deriving logarithmic formulas or algorithm implementations.
Examples
Compares array searching, heapsort, pair generation, and subarray generation through estimated asymptotic running times.
What you can do after
Evaluate/understand an algorithm’s approximate order of growth and distinguish slow scaling from rapidly accelerating alternatives.
How it connects
Connects logarithmic growth with Big-O notation, asymptotic analysis, linearithmic functions, polynomial functions, and exponential functions.

Also explained in

Compare how 3 books explain logarithm →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Data Structures. The section links point to the parts of the book it draws on.