# 停车函数

停车函数是一个由正整数组成的序列 \((a_1, \ldots, a_n)\)，其中每一项至多为 \(n\)，并且具有如下性质：\(n\) 辆车按照标准停车规则，能够全部停在排成一列的 \(n\) 个车位中。第 \(i\) 辆车驶向其首选车位 \(a_i\)；若该车位已被占用，则取右侧下一个空位；若 \(a_i\) 及其右侧均无空位，则过程失败。使每辆车都能停好的序列称为停车函数；这一名称由艾伦·G·康海姆（Alan G. Konheim）和本杰明·韦斯（Benjamin Weiss）在 1966 年研究哈希中出现的占用规则时引入。<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup><sup> • </sup><sup>[2](https://doi.org/10.1016/j.aam.2017.05.004)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 一个序列 \((a_1, \ldots, a_n)\)，满足 \(1 \le a_i \le n\)，使得全部 \(n\) 辆车都能按如下规则停好：驶向 \(a_i\)，或取右侧下一个空位<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup> |
| 重排判据 | 该序列是停车函数，当且仅当其非降重排 \((b_1, \ldots, b_n)\) 满足 \(b_i \le i\)，其中 \(1 \le i \le n\)<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup><sup> • </sup><sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup> |
| 计数 | 长度为 \(n \ge 1\) 的停车函数有 \((n+1)^{n-1}\) 个，这一结果最著名的证明是亨利·O·波拉克（Henry O. Pollak）的圆环论证<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup><sup> • </sup><sup>[4](https://math.mit.edu/~rstan/transparencies/pf.pdf)</sup> |
| 对称性 | 停车函数各项的任意排列仍是停车函数<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup><sup> • </sup><sup>[4](https://math.mit.edu/~rstan/transparencies/pf.pdf)</sup> |
| 树双射 | 长度为 \(n\) 的停车函数与 \(n+1\) 个顶点（根为 0）的有根标号树双射，也与 \(n\) 个顶点上的标号有根森林双射<sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup><sup> • </sup><sup>[5](https://escholarship.org/uc/item/9862s2dg)</sup> |
| Shi 排列 | Shi 排列 \(\mathcal{S}_n\) 的区域数为 \((n+1)^{n-1}\)，并与停车函数显式双射<sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup> |
| 起源 | 由康海姆和韦斯（1966）引入，用于分析线性探测哈希<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup><sup> • </sup><sup>[2](https://doi.org/10.1016/j.aam.2017.05.004)</sup> |

## 停车过程与判据

该模型是一条单行道，车位编号为 \(1\) 到 \(n\)。汽车按其编号顺序到达，每辆车都有一个声明的偏好。若偏好车位空闲，汽车就停在该处；否则它向右移动到第一个空位。若在任一阶段，偏好车位及其右侧都没有可用车位，则过程中止，该序列不是停车函数。<sup>[2](https://doi.org/10.1016/j.aam.2017.05.004)</sup><sup> • </sup><sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup>

对于 \(n = 3\)，序列 \((2, 1, 2)\) 是停车函数：三辆车分别占用车位 2、1 和 3。序列 \((2, 2, 2)\) 不是停车函数，因为第三辆车发现车位 2 和 3 已被占用，没有剩余车位。<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup>

停车结果与偏好的列出顺序无关。将序列排序为 \(b_1 \le b_2 \le \cdots \le b_n\)，该序列是停车函数，当且仅当对每个 \(i\) 都有 \(b_i \le i\)。<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup><sup> • </sup><sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup> 必要性是直接的：对任意 \(k\)，至少 \(k\) 辆车必须偏好 \(1, \ldots, k\) 中的车位，否则这 \(k\) 个车位不可能全被填满。充分性由最小反例论证得到：若前 \(n-1\) 辆车都停好而最后一辆失败，则某个最小的 \(j\) 使得车位 \(\{j, \ldots, n\}\) 全被占用，而车位 \(j-1\) 为空，这迫使 \(b_{j-1} > j-1\)，与假设矛盾。<sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup>

## 计数与波拉克的圆环论证

长度为 \(n\) 的停车函数个数为 \((n+1)^{n-1}\)，这一结果归功于罗纳德·派克（Ronald Pyke，1959）以及康海姆和韦斯（1966）。<sup>[4](https://math.mit.edu/~rstan/transparencies/pf.pdf)</sup> 最著名的证明由亨利·O·波拉克于 1974 年前后给出。增加一个额外车位 \(n+1\)，将 \(n+1\) 个车位排成一圈，并允许 \(n+1\) 作为偏好。在圆环上，每个偏好序列都能让所有车停好，且恰好有一个车位空着。旋转对称性使每个车位成为空位的可能性相同；将所有偏好平移 \(j\)（模 \(n+1\)）也会使每个停车位置平移 \(j\)。在 \((n+1)^n\) 个圆环序列中，每个大小为 \(n+1\) 的轨道中恰有一个使车位 \(n+1\) 空着；在空位处剪开圆环便恢复线性规则，得到 \((n+1)^n/(n+1) = (n+1)^{n-1}\)。<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup><sup> • </sup><sup>[4](https://math.mit.edu/~rstan/transparencies/pf.pdf)</sup>

在这一计数中，弱递增的停车函数由卡塔兰数 \(C_n\) 计数。<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup><sup> • </sup><sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup> 一个相关概念是素停车函数，由艾拉·格塞尔（Ira Gessel）定义为删去一个 1 后仍是停车函数的停车函数。<sup>[4](https://math.mit.edu/~rstan/transparencies/pf.pdf)</sup>

## 与树和超平面排列的联系

长度为 \(n\) 的停车函数与以 0 为根、有 \(n+1\) 个顶点的有根标号树等数，且已知显式双射。一种构造按广度优先顺序逐层读取树的顶点，将边从子指向父，并令：若 \(i\) 与根相邻，则 \(p_i = 1\)；若 \(i\) 指向读取顺序中的第 \(j\) 个顶点，则 \(p_i = 1 + j\)；该映射可逆。<sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup> 等价地，长度为 \(n\) 的停车函数对应于 \(n\) 个顶点上的标号有根森林。<sup>[5](https://escholarship.org/uc/item/9862s2dg)</sup>

同一个数 \((n+1)^{n-1}\) 计数 Shi 排列 \(\mathcal{S}_n\) 的区域数；该排列是超平面集合 \(x_i - x_j = 0\) 与 \(x_i - x_j = 1\)（\(1 \le i < j \le n\)），由石（J.-Y. Shi）在研究 \(A_{n-1}\) 型仿射外尔群时引入。\(\mathcal{S}_n\) 的区域与 \([n]\) 上的停车函数之间存在显式双射：每个停车函数通过将取值相同的指标分组，确定 \([n]\) 的一个链划分，而这些链编码一个唯一的 Shi 区域。<sup>[3](https://www.symmetricfunctions.com/parking-functions.htm)</sup> 用停车函数给 Shi 区域标号称为帕克–斯坦利标号；它可推广到 \(k\)-Shi 排列和 \(k\)-停车函数，并且对于图 \(G\)，可推广到由 \(G\)-停车函数标号的 \(G\)-Shi 排列。<sup>[6](https://arxiv.org/abs/1501.01225)</sup>

## 统计量与概率

两个统计量记录汽车行驶了多远。对停车函数 \(\pi\)，不便量 \(I(\pi)\)（汽车越过其偏好所多行驶的车位总数）等于 \(\binom{n+1}{2} - (\pi_1 + \cdots + \pi_n)\)；在线性探测文献中，这个量称为总位移。例如，当 \(n = 5\) 时，停车函数 \((1, 3, 5, 3, 1)\) 产生停车结果 11335，且 \(I(\pi) = 2\)：两辆车各停在比其偏好远一个车位的位置。<sup>[2](https://doi.org/10.1016/j.aam.2017.05.004)</sup>

斯坦福大学统计学与数学教授珀西·迪亚科尼斯（Persi Diaconis）和安吉拉·希克斯（Angela Hicks）研究了“随机停车函数看起来是什么样？”这一问题，给出了已知生成函数的概率解释，分类了那些在停车函数中的分布与其在所有函数中的分布相同的统计量，并建立了停车函数与布朗游程理论之间的联系。<sup>[2](https://doi.org/10.1016/j.aam.2017.05.004)</sup> 耶鲁大学的理查德·凯尼恩（Richard Kenyon）和丹佛大学的尹梅（Mei Yin）后来研究了 \(m\) 辆车、\(n\) 个车位的广义情形，构造了 \(\mathrm{PF}(m, n)\) 与 \(n+1\) 个顶点上、具有 \(n+1-m\) 棵指定根树的生成森林之间的双射，并推导了均匀停车函数坐标的分布律和协方差。<sup>[7](https://arxiv.org/abs/2103.17180)</sup><sup> • </sup><sup>[8](https://arxiv.org/abs/2107.01767)</sup>

## 推广

基本模型有许多变体。那不勒斯停车函数允许汽车在发现其偏好车位被占时，向前和向后搜索有限个车位。<sup>[1](https://mathworld.wolfram.com/ParkingFunction.html)</sup> 在区间停车函数中，每位司机只接受一个固定车位区间；在回拉停车函数中，移动向后受参数 \(k\) 限制，向前受参数 \(\ell\) 限制。<sup>[8](https://arxiv.org/abs/2107.01767)</sup><sup> • </sup><sup>[9](https://www.arxiv.symmetricfunctions.com/paper/2503.17256v1)</sup> 对正整数向量 \(\mathbf{b} = (b_1, \ldots, b_n)\)，\(\mathbf{b}\)-停车函数是一个序列，其非降重排 \(\beta'_1 \le \cdots \le \beta'_n\) 满足 \(\beta'_i \le b_1 + \cdots + b_i\)；这些序列在 \(\mathbb{R}^n\) 中的凸包，即 \(\mathbf{b}\)-停车函数多面体，是一个广义排列多面体。<sup>[10](https://link.springer.com/article/10.1007/s00454-025-00770-1)</sup>

最初的应用至今仍有现实意义：在线性探测哈希中，哈希表通过从首选单元开始依次向前探测来解决冲突，而满表的成功插入模式恰好对应于停车函数。<sup>[2](https://doi.org/10.1016/j.aam.2017.05.004)</sup>

## References

1. [Weisstein, Eric W. "Parking Function." MathWorld–A Wolfram Resource.](https://mathworld.wolfram.com/ParkingFunction.html)
2. [Diaconis, Persi, and Angela Hicks (2017). "Probabilizing parking functions." Advances in Applied Mathematics 89: 125–155.](https://doi.org/10.1016/j.aam.2017.05.004)
3. ["Parking functions." SymCat, symmetricfunctions.com.](https://www.symmetricfunctions.com/parking-functions.htm)
4. [Stanley, Richard P. "A Survey of Parking Functions" (lecture slides).](https://math.mit.edu/~rstan/transparencies/pf.pdf)
5. [Stanley, Richard P., and Mei Yin (2025). "Some enumerative properties of parking functions."](https://escholarship.org/uc/item/9862s2dg)
6. [Duarte, Rui, and António Guedes de Oliveira (2018). "Multigraph Hyperplane Arrangements and Parking Functions." arXiv:1501.01225.](https://arxiv.org/abs/1501.01225)
7. [Kenyon, Richard, and Mei Yin (2021). "Parking functions: From combinatorics to probability." arXiv:2103.17180.](https://arxiv.org/abs/2103.17180)
8. [Kenyon, Richard, and Mei Yin (2021). "Parking functions: Interdisciplinary connections." arXiv:2107.01767.](https://arxiv.org/abs/2107.01767)
9. [Elder, Jennifer, Pamela E. Harris, Lybitina Koene, Ilana Lavene, Lucy Martinez, and Molly Oldham (2025). "Pullback parking functions." arXiv:2503.17256.](https://www.arxiv.symmetricfunctions.com/paper/2503.17256v1)
10. [Bayer, Margaret M., Steffen Borgwardt, Teressa Chambers, et al. (2025). "Combinatorics of Generalized Parking-Function Polytopes." Discrete & Computational Geometry 76: 339–377.](https://link.springer.com/article/10.1007/s00454-025-00770-1)

---
*Initially written Oct 15, 2026 · Edited: Oct 25, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Computational and symbolic algebra › Algebraic combinatorics and graph theory

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/parking-function

English original: https://www.edgepedia.org/parking-function
