Unify punctuation.

This commit is contained in:
krahets
2023-07-26 08:59:36 +08:00
parent 35973068a7
commit 63a0e73df0
46 changed files with 201 additions and 201 deletions

View File

@@ -12,9 +12,9 @@
1. 计算中点索引 $m = \lfloor {(i + j) / 2} \rfloor$ ,其中 $\lfloor \space \rfloor$ 表示向下取整操作。
2. 判断 `nums[m]``target` 的大小关系,分为三种情况:
1.`nums[m] < target` 时,说明 `target` 在区间 $[m + 1, j]$ 中,因此执行 $i = m + 1$
2.`nums[m] > target` 时,说明 `target` 在区间 $[i, m - 1]$ 中,因此执行 $j = m - 1$
3.`nums[m] = target` 时,说明找到 `target` ,因此返回索引 $m$
1.`nums[m] < target` 时,说明 `target` 在区间 $[m + 1, j]$ 中,因此执行 $i = m + 1$
2.`nums[m] > target` 时,说明 `target` 在区间 $[i, m - 1]$ 中,因此执行 $j = m - 1$
3.`nums[m] = target` 时,说明找到 `target` ,因此返回索引 $m$
若数组不包含目标元素,搜索区间最终会缩小为空。此时返回 $-1$ 。