mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-15 21:20:58 +00:00
deploy
This commit is contained in:
@@ -3396,7 +3396,7 @@
|
||||
<h2 id="1021">10.2.1. 线性方法<a class="headerlink" href="#1021" title="Permanent link">¶</a></h2>
|
||||
<p>为了查找数组中最左边的 <code>target</code> ,我们可以分为两步:</p>
|
||||
<ol>
|
||||
<li>进行二分查找,定位到任意一个 <code>target</code> 的索引,记为 <span class="arithmatex">\(k\)</span> ;</li>
|
||||
<li>进行二分查找,定位到任意一个 <code>target</code> 的索引,记为 <span class="arithmatex">\(k\)</span> 。</li>
|
||||
<li>以索引 <span class="arithmatex">\(k\)</span> 为起始点,向左进行线性遍历,找到最左边的 <code>target</code> 返回即可。</li>
|
||||
</ol>
|
||||
<p><img alt="线性查找最左边的元素" src="../binary_search_edge.assets/binary_search_left_edge_naive.png" /></p>
|
||||
|
||||
Reference in New Issue
Block a user