Remove center-table from docs.

Add header to the tables.
This commit is contained in:
krahets
2023-08-19 19:22:08 +08:00
parent 4eb621dda7
commit 70227c82cb
18 changed files with 26 additions and 78 deletions

View File

@ -73,13 +73,10 @@ $$
## 图常见应用
实际应用中,许多系统都可以用图来建模,相应的待求解问题也可以约化为图计算问题。
<div class="center-table" markdown>
<p align="center"> 表:现实生活中常见的图 </p>
| | 顶点 | 边 | 图计算问题 |
| ------ | ---- | --------------- | ------------ |
| 社交网络 | 用户 | 好友关系 | 潜在好友推荐 |
| 地铁线路 | 站点 | 站点间的连通性 | 最短路线推荐 |
| 太阳系 | 星体 | 星体间的万有引力作用 | 行星轨道计算 |
</div>

View File

@ -206,8 +206,7 @@
## 效率对比
设图中共有 $n$ 个顶点和 $m$ 条边,下表为邻接矩阵和邻接表的时间和空间效率对比。
<div class="center-table" markdown>
<p align="center"> 表:邻接矩阵与邻接表对比 </p>
| | 邻接矩阵 | 邻接表(链表) | 邻接表(哈希表) |
| ------------ | -------- | -------------- | ---------------- |
@ -218,6 +217,4 @@
| 删除顶点 | $O(n^2)$ | $O(n + m)$ | $O(n)$ |
| 内存空间占用 | $O(n^2)$ | $O(n + m)$ | $O(n + m)$ |
</div>
观察上表,似乎邻接表(哈希表)的时间与空间效率最优。但实际上,在邻接矩阵中操作边的效率更高,只需要一次数组访问或赋值操作即可。综合来看,邻接矩阵体现了“以空间换时间”的原则,而邻接表体现了“以时间换空间”的原则。