liveBook · Manning

Pivot

As explained in Advanced Algorithms and Data Structures

A pivot is a selected element whose value determines how a collection is divided during a partitioning procedure.

A pivot is a selected element whose value determines how a collection is divided during partitioning. In a binary search tree, the pivot becomes a node; its left and right subtrees represent the two resulting partitions. section 9.2 section 9.2.1

In multidimensional partitioning, a pivot also determines the coordinate used for the split:

  • Split a two-dimensional region vertically by comparing points’ x coordinates, or horizontally by comparing their y coordinates. section 9.2
  • Cycle through dimensions or directions at successive levels, using a perpendicular split for the next pivot. section 9.2
  • Associate each pivot with the region formed by its ancestors’ partitions; deeper pivots cover progressively smaller regions. section 9.2.1

Alternating spatial splits

Choose point R as the first pivot and split vertically. Choose point W in the left partition and split it horizontally; choose point P in the resulting upper-left region and split vertically again. The same process turns Opal City into a k-d tree root and Civic City into a child created by the next perpendicular split. section 9.2

How Advanced Algorithms and Data Structures covers it

How deep it goes
Defines pivots and explains their coordinate-based splits, tree placement, and hierarchical regions without detailing selection heuristics.
Examples
Uses points R, W, and P plus Opal City and Civic City to demonstrate successive spatial partitions.
What it assumes
Assumes coordinate comparisons and binary-tree terminology while framing k-d trees as binary search trees with specialized key comparisons.
What you can do after
Build a binary or k-d tree by selecting pivots and assigning each partition to the corresponding subtree.
How it connects
Connects partitioning with binary search trees, k-d trees, coordinate comparisons, and multidimensional indexing.

Also explained in

Compare how 4 books explain pivot →

Related concepts

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