liveBook · Manning

Linearithmic function

As explained in Grokking Data Structures

Linearithmic growth is growth proportional to the product of input size and its logarithm.

A linearithmic function grows in proportion to the input size multiplied by its logarithm: O(n * log(n)). Its growth accelerates as inputs grow, but remains far slower than quadratic or exponential growth. section 4.8

Use the growth class to compare how algorithms behave as inputs become larger:

  • It grows faster than logarithmic and linear functions, so additional input increases the running time by increasingly larger amounts. section 4.8
  • It remains manageable for large inputs compared with quadratic functions, which become impractical much sooner. section 4.9
  • It commonly describes efficient sorting algorithms and the behavior of priority queues. section 4.9 section 4.16

Choosing a sorting algorithm

For a billion-element array, a linearithmic algorithm such as mergesort or heapsort is described as manageable, while quadratic selection sort would take an impractical amount of time. section 4.9

Some of the growth rates you might encounter when studying algorithms. From left to right, the functions grow increasingly faster.

A growth-rate figure makes the relative acceleration of linearithmic, quadratic, and faster function classes easier to compare visually. section 4.8

How Grokking Data Structures covers it

How deep it goes
Defines O(n * log(n)) and compares its acceleration with logarithmic, linear, quadratic, and exponential growth.
Examples
Uses mergesort and heapsort as linearithmic examples, contrasting them with quadratic selection sort.
What it assumes
Introduces asymptotic growth classes and assumes only a simplified RAM model with constant-time basic instructions.
What you can do after
Evaluate algorithm choices by comparing linearithmic growth with slower and faster asymptotic classes.
How it connects
Connects Big-O notation with sorting algorithms, priority queues, logarithmic growth, linear growth, and quadratic growth.

Also explained in

Compare how 2 books explain linearithmic function →

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.