Skip to content

Commit 4ce3c84

Browse files
Update src/geometry/nearest_points.md
Better formatting Co-authored-by: Oleksandr Kulkov <adamant.pwn@gmail.com>
1 parent 50bb91b commit 4ce3c84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/geometry/nearest_points.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ An alternative method arises from a very simple idea to heuristically improve th
173173
</div>
174174

175175

176-
We will consider only the squares containing at least one point. Denote by $n_1, n_2, \dots, n_k$ the number of points in each of the $k$ remaining squares. Assuming at least two points are in the same or in adjacent squares, the time complexity is $\Theta(\sum_{i=1}^{k} n_i^2)$.
176+
We will consider only the squares containing at least one point. Denote by $n_1, n_2, \dots, n_k$ the number of points in each of the $k$ remaining squares. Assuming at least two points are in the same or in adjacent squares, the time complexity is $\Theta\left(\sum\limits_{i=1}^k n_i^2\right)$.
177177

178178
??? info "Proof"
179179
For the $i$-th square containing $n_i$ points, the number of pairs inside is $\Theta(n_i^2)$. If the $i$-th square is adjacent to the $j$-th square, then we also perform $n_i n_j \le \max(n_i, n_j)^2 \le n_i^2 + n_j^2$ distance comparisons. Notice that each cube has at most $8$ adjacent cubes, so we can bound the sum of all comparisons by $\Theta(\sum_{i=1}^{k} n_i^2)$. $\quad \blacksquare$

0 commit comments

Comments
 (0)